XMLSocket
Speaking of Flash…I’ve been messing around with Flash MX and its support for persistent, two-way streaming connections via the XMLSocket stuff. Interesting point: you can do arbitrary HTTP requests by shoehorning the text of the request into a malformed XML document:
socket = new XMLSocket();
socket.onData = function (src)
{
trace("\ndata:" + src);
}
if (!socket.connect("my.example.com", 80))
{
trace ("connect: Connection failed!")
}
var req = "POST /mod_pubsub/demo HTTP/1.0\n" +
"User-Agent: FlashMX Client (Win2K)\n" +
"Host: my.example.com\n" +
"Content-Length: 12\n" +
"Content-Type: text/plain\n\n" +
"Hello World!";
var xml = new XML(req);
socket.send(xml);
Through this, I’ve been able to hook up Flash MX to a KnowNow event router (the same should work for mod_pubsub, but I haven’t tested it yet) with varying degrees of success. A small sticking point seems to be that any returned data has to be terminated with a null character (like “%00″) or the data handlers won’t fire. But it’s encouraging to know that you can effectively speak HTTP over XMLSocket without having to speak XML.
Previously: Unswitch
Next: XHTML 2.0 Smackdown!