Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Do open websockets use bandwidth or other resources?

If I have a websocket connection open between a server and a desktop client, is it true that there is no data or bandwidth being used or exchanged between the two except for when I explicitly send some? And if that is true, does that mean I could essentially have thousands of open connections on a server at a time so long as data was only being transferred very infrequently?

like image 262
Christopher Shroba Avatar asked Jun 07 '14 00:06

Christopher Shroba


1 Answers

Technically yes. Although the WebSocket protocol has ping/pong frames, and the any of the two ends can send pings periodically and expect pongs as answers, otherwise the would kill the connection.

It would be a very bad idea not implement a "keep alive" mechanism, you won't be able of tell which connections are actually connected or improperly closed.

http://blog.stephencleary.com/2009/05/detection-of-half-open-dropped.html

like image 95
vtortola Avatar answered Nov 07 '22 12:11

vtortola