Webtide

Sprocket and Browser Sockets

by Dylan SchiemannJuly 3rd, 2008

David Davis, co-creator of the Cometd project, read through Michael Carter’s recent post on Sockets in the Browser points out that Sprocket.Socket also supports sockets in the browser. Sprocket is a Perl networking framework that provides a foundation for the Perl implementation of Cometd.

Additional notes from David:

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.

[Slashdot] [Digg] [Reddit] [del.icio.us] [Facebook] [Technorati] [Google] [StumbleUpon]
SitePen, Inc. Comet Services

Leave a Reply



Copyright 2008 Comet Daily, LLC. All Rights Reserved