Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6818475
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T21:10:59+00:00 2026-05-26T21:10:59+00:00

I am developing a WebSocket server with C# and I noticed that all the

  • 0

I am developing a WebSocket server with C# and I noticed that all the messages that coming from the browser (Chrome in that case) using the send() method are 126 chars length max.
It happens all the time when I want to send messages larger that 126 chars, looks like the protocol cuts any message larger then 126 chars and transfer only the first 126 chars.
I tried to check on the protocol definition but didn’t find any answer.

So, my question is, can I send larger messages over WebSockets?

UPDATE:
This is the way that I’m parsing the messages from the client (Chrome) in my C# WebSocket server:

    private void ReceiveCallback(IAsyncResult _result)
    {
        lock (lckRead)
        {
            string message = string.Empty;
            int startIndex = 2;
            Int64 dataLength = (byte)(buffer[1] & 0x7F); // when the message is larger then 126 chars it cuts here and all i get is the first 126 chars
            if (dataLength > 0)
            {
                if (dataLength == 126)
                {
                    BitConverter.ToInt16(buffer, startIndex);
                    startIndex = 4;
                }
                else if (dataLength == 127)
                {
                    BitConverter.ToInt64(buffer, startIndex);
                    startIndex = 10;
                }

                bool masked = Convert.ToBoolean((buffer[1] & 0x80) >> 7);
                int maskKey = 0;
                if (masked)
                {
                    maskKey = BitConverter.ToInt32(buffer, startIndex);
                    startIndex = startIndex + 4;
                }

                byte[] payload = new byte[dataLength];
                Array.Copy(buffer, (int)startIndex, payload, 0, (int)dataLength);
                if (masked)
                {
                    payload = MaskBytes(payload, maskKey);
                    message = Encoding.UTF8.GetString(payload);
                    OnDataReceived(new DataReceivedEventArgs(message.Length, message));
                }

                HandleMessage(message); //'message' -  the message that received

                Listen();
            }
            else
            {
                if (ClientDisconnected != null)
                    ClientDisconnected(this, EventArgs.Empty);
            }
        }
    }

I still didn’t understand how can I get larger message, its maybe something with the opcode, but I don’t know what to change to make it work?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T21:11:00+00:00Added an answer on May 26, 2026 at 9:11 pm

    WebSocket messages can be of any size. However, large messages are usually transmitted in multiple parts (fragments) to avoid head-of-line blocking. See the WebSockets I-D for details.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm developing a websockter server using node.js and I've discovered some quirks in Chrome.
Developing a chrome extension using javascript is one of my university projects. I don't
Im developing a windows forms application using C# 4.0 and that application is going
Developing a Sencha Touch MVC app that pulls data from json store (thats set
I am developing a webscoket server using node.js, and as I'm finishing up my
Developing server side code i finally got my eyes X-crossed trying to write -
Developing a site that requires monthly subscriptions via PayPal. If a buyer has an
Developing a series of POCOs on my project, and just realized that some of
Developing for iPhone, I have a collection of points that I need to make
Developing an application for Android, i want to record data that will be usefull

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.