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

  • SEARCH
  • Home
  • 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 6320429
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T15:58:16+00:00 2026-05-24T15:58:16+00:00

Since Chrome updated to v14, they went from version three of the draft to

  • 0

Since Chrome updated to v14, they went from version three of the draft to version eight of the draft.

I have an internal chat application running on WebSocket, and although I’ve gotten the new handshake working, the data framing apparently has changed as well. My WebSocket server is based on Nugget.

Does anybody have WebSocket working with version eight of the draft and have an example on how to frame the data being sent over the wire?

  • 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-24T15:58:17+00:00Added an answer on May 24, 2026 at 3:58 pm

    (See also: How can I send and receive WebSocket messages on the server side?)


    It’s fairly easy, but it’s important to understand the format.

    The first byte is almost always 1000 0001, where the 1 means "last frame", the three 0s are reserved bits without any meaning so far and the 0001 means that it’s a text frame (which Chrome sends with the ws.send() method).

    (Update: Chrome can now also send binary frames with an ArrayBuffer. The last four bits of the first byte will be 0002, so you can differ between text and binary data. The decoding of the data works exactly the same way.)

    The second byte contains of a 1 (meaning that it’s "masked" (encoded)) followed by seven bits which represent the frame size. If it’s between 000 0000 and 111 1101, that’s the size. If it’s 111 1110, the following 2 bytes are the length (because it wouldn’t fit in seven bits), and if it’s 111 1111, the following 8 bytes are the length (if it wouldn’t fit in two bytes either).

    Following that are four bytes which are the "masks" which you need to decode the frame data. This is done using xor encoding which uses one of the masks as defined by indexOfByteInData mod 4 of the data. Decoding simply works like encodedByte xor maskByte (where maskByte is indexOfByteInData mod 4).

    Now I must say I’m not experienced with C# at all, but this is some pseudocode (some JavaScript accent I’m afraid):

    var length_code = bytes[1] & 127, // remove the first 1 by doing '& 127'
        masks,
        data;
    
    if(length_code === 126) {
        masks = bytes.slice(4, 8);   // 'slice' returns part of the byte array
        data  = bytes.slice(8);      // and accepts 'start' (inclusively)
    } else if(length_code === 127) { // and 'end' (exclusively) as arguments
        masks = bytes.slice(10, 14); // Passing no 'end' makes 'end' the length
        data  = bytes.slice(14);     // of the array
    } else {
        masks = bytes.slice(2, 6);
        data  = bytes.slice(6);
    }
    
    // 'map' replaces each element in the array as per a specified function
    // (each element will be replaced with what is returned by the function)
    // The passed function accepts the value and index of the element as its
    // arguments
    var decoded = data.map(function(byte, index) { // index === 0 for the first byte
        return byte ^ masks[ index % 4 ];          // of 'data', not of 'bytes'
        //         xor            mod
    });
    

    You can also download the specification which can be helpful (it of course contains everything you need to understand the format).

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

Sidebar

Related Questions

Since while Google Chrome started to beehive strange with Adobe Flash Player. I have
NOTE: I have updated this since originally asking the question to reflect some of
I've just noticed that at some stage Chrome has updated to a new version
Since it seems none exist, I'm trying to make a chrome extension to set
Since I am developing an iOS >= 5.0 application, I am trying to change
Since now I have only used plugin for editing and the way I use
Since input and raw_input() stop the program from running anymore, I want to use
Since I have no errors I don't know if this is the right place
Since today I am facing a tricky issue with Google Chrome that I've just
I have a <td> that is just about empty since it only contains an

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.