[LINK] WebSockets

Martin Barry marty at supine.com
Wed Apr 6 20:48:35 AEST 2011


Replying to an old thread but I've just come back from a holiday so...

$quoted_author = "Kim Holburn" ;
> 
> I expect he means a TCP stream using a kind of embraced and extended HTTPS
> apps layer protocol except instead of a browser at the client end you have
> an exchange client and instead of a webserver at the server end you have
> an exchange server.  So they can extend the protocol in a proprietary way
> and there's no interoperability problems with other software.  And like
> http you can keep the connection open for as long as you like.

The problem that WebSockets is trying to solve is not with TCP but with
HTTP.

HTTP is a request/response protocol. The client requests something, the
server responds. There is no way for the server to push something. The usual
workaround is have the client poll for new data instead. The neatest, lowest
latency implementation of that is long polling (a subset of Comet
http://en.wikipedia.org/wiki/Comet_%28programming%29 ).

It works something like:

- client requests data
- server waits until is has new data to send before responding
- if no new data is available just prior to the client timeout the server
  responds with "no data"
- the client immediately repeats the request in step 1

This gets you data as soon as it is available without polling more often
than the timeout value if there is no new data.

WebSockets removes the need for these "crutches" by allowing the client to
open a connection over which the server can push data at will.

cheers
Marty



More information about the Link mailing list