1 post tagged “cgi”
My project, Sprocket.Socket must have inspired, Michael Carter of orbitd: Comet Daily: Sockets in the Browser
One thing he didn't consider is that you need data framing to handle raw data from sockets correctly.
For instance, if you are parsing lines of data from a socket:
This is a line\r\n
This is another line\r\n
This is
You received a partial line, like the last line above. You need to wait for the rest of the line, and buffer it until you reach a line ending, which in this case is \r\n
I'm a POE programmer, and we have modules that frame data, and we call them Filters.
I have written several data framing filters in JavaScript, inspired by POE filters:
http://svn.xantus.org/sprocket/trunk/Sprocket-JavaScript/js/Ext-ux/Sprocket/
JSON, IRC, Line, etc
I think having pseudo-sockets in the browser is very useful if done right. Sprocket.Socket handles multiple outgoing connections from the browser using only one long polling xmlhttp. A spare xmlhttp request is used for quick sending of data while the other is waiting, so it doesn't have to be woken up. All data is delivered in order.
Sprocket.Socket consists of several parts:
The framework, Sprocket
Sprocket.HTTP plugin. It serves files, fast. Including CGI's
Sprocket.Socket plugin. This proxies the socket requests
An access control module. Controls which hosts the clients can connect to.
The JavaScript library Sprocket.Socket. This handles the pseudo-sockets in the browser
The JavaScript data framing filters, and base class
Extjs, a rich js framework.
This seems like a lot, but I can run one script and fire up a browser to get it to work.
I have a working IRC client built on all of this :)
Stay tuned for more