After reading RFC6455 and WSAPI, I was led to the following relevant detail:

http://www.w3.org/TR/websockets/#dom-websocket-bufferedamount

Quoting:

In this simple example, the bufferedAmount attribute is used to ensure that
updates are sent either at the rate of one update every 50ms, if the
network can handle that rate, or at whatever rate the network can handle,
if that is too fast.

var socket = new WebSocket('ws://game.example.com:12010/updates');
socket.onopen = function () {
  setInterval(function() {
    if (socket.bufferedAmount == 0)
      socket.send(getUpdateData());
  }, 50);
};

The bufferedAmount attribute can also be used to saturate the network
without sending the data at a higher rate than the network can handle,
though this requires more careful monitoring of the value of the attribute
over time.


Based on that, it seems that senders have to monitor the bufferedAmount in
order to ensure that they are not exceeding the network bandwidth and the
processing speed of the receiver.

On Wed, Jan 23, 2013 at 10:09 AM, Nils Kilden-Pedersen <[email protected]>
wrote:
>
> On Wed, Jan 23, 2013 at 11:44 AM, Brandon Mintern <[email protected]>
wrote:
>>
>> If my client is sending a steady stream of unthrottled binary data, too
fast for the server to keep up, what happens? My assumption was that
WebSockets were designed so that the Javascript client's send request would
block if some kind of buffer was full, but I'm starting to think that might
not be correct.
>>
>> What does Jetty do internally when the server-side onMessage callback is
taking a while to process? I know that there must be some buffering
occurring in a receiving thread, but what happens when the buffer is full?
Does it just respond to the client with an error code?
>
>
> Also it'd be interesting to know what happens with slow consuming clients.
>
>
>>
>>
>> _______________________________________________
>> jetty-users mailing list
>> [email protected]
>> https://dev.eclipse.org/mailman/listinfo/jetty-users
>>
>
>
> _______________________________________________
> jetty-users mailing list
> [email protected]
> https://dev.eclipse.org/mailman/listinfo/jetty-users
>
_______________________________________________
jetty-users mailing list
[email protected]
https://dev.eclipse.org/mailman/listinfo/jetty-users

Reply via email to