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 8742175
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T11:27:11+00:00 2026-06-13T11:27:11+00:00

since I’m using WebSocket connections on more regular bases, I was interested in how

  • 0

since I’m using WebSocket connections on more regular bases, I was interested in how things work under the hood. So I digged into the endless spec documents for a while, but so far I couldn’t really find anything about chunking the transmission stream itself.

The WebSocket protocol calls it data frames (which describes the pure data stream, so its also called non-control frames). As far as I understood the spec, there is no defined max-length and no defined MTU (maximum transfer unit) value, that in turn means a single WebSocket data-frame may contain, by spec(!), an infinite amount of data (please correct me if I’m wrong here, I’m still a student on this).

After reading that, I instantly setup my little Node WebSocket server. Since I have a strong Ajax history (also on streaming and Comet), my expectations originaly were like, “there must be some kind of interactive mode for reading data while it is transfered“. But I am wrong there, ain’t I ?

I started out small, with 4kb of data.

server

testSocket.emit( 'data', new Array( 4096 ).join( 'X' ) );

and like expected this arrives on the client as one data-chunk

client

wsInstance.onmessage = function( data ) {
    console.log( data.length ); // 4095
};

so I increased the payload and I actually was expecting again, that at some point, the client-side onmessage handler will fire repeatly, effectivley chunking the transmission. But to my shock, it never happened (node-server, tested on firefox, chrome and safari client-side). My biggest payload was 80 MB

testSocket.emit( 'data', new Array( 1024*1024*80 ).join( 'X' ) );

and it still arrived in one big data-chunk on the client. Of course, this takes a while even if you have a pretty good connection. Questions here are

  • is there any possiblity to chunk those streams, similar to the XHR readyState3 mode ?
  • is there any size limit for a single ws data-frame ?
  • are websockets not supposed to transfer such large payloads? (which would make me wonder again why there isn’t a defined max-size)

I might still look from the wrong perspective on WebSockets, probably the need for sending large data-amounts is just not there and you should chunk/split any data logically yourself before sending ?

  • 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-06-13T11:27:12+00:00Added an answer on June 13, 2026 at 11:27 am

    First, you need to differentiate between the WebSocket protocol and the WebSocket API within browsers.

    The WebSocket protocol has a frame-size limit of 2^63 octets, but a WebSocket message can be composed of an unlimited number of frames.

    The WebSocket API within browsers does not expose a frame-based or streaming API, but only a message-based API. The payload of an incoming message is always completely buffered up (within the browser’s WebSocket implementation) before providing it to JavaScript.

    APIs of other WebSocket implementations may provide frame- or streaming-based access to payload transferred via the WebSocket protocol. For example, AutobahnPython does. You can read more in the examples here https://github.com/tavendo/AutobahnPython/tree/master/examples/twisted/websocket/streaming.

    Disclosure: I am original author of Autobahn and work for Tavendo.

    More considerations:

    As long as there is no frame/streaming API in browser JS WebSocket API, you can only receive/send complete WS messages.

    A single (plain) WebSocket connection cannot interleave the payload of multiple messages. So i.e. if you use large messages, those are delivered in order, and you won’t be able to send small messages in between while a big message is still on the fly.

    Note also: you can open multiple WS connections (over different underlying TCPs) to a single target server from a single JS / HTML page today.

    Note also: you can do "chunking" yourself in application layer: send your stuff in smaller WS messages a reassemble yourself.

    I agree, in an ideal world, you’d have message/frame/streaming API in browser plus WebSocket multiplexing. That would give all the power and convenience.

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

Sidebar

Related Questions

Since regular jQuery animations are not fluent on iOS ( .hide() , slideDown() ),
Since Intellij does not yet support the Play-Scala-Template-Engine I was thinking about using plain
Since I need mulitple screens, 1) can I define more than one game class(inherited
Since I started using Fireworks CS5.1, and it doesn't matter how I write the
Since any JSF page gets transformed at the server side into its equivalent HTML
Since yesterday suddenly my Eclipse does not work anymore. The error is Failed to
Since R8 there is no option to run more than one instance of Domino
Since a static function call is translated into a static invocation bytecode regardless of
Since websql is depreciated so I was looking into IndexedDB for browser offline storage
Since I'm using gtk3 and gtkmm3 on embedded I would like to have the

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.