Reputation: 18449
I would like to be able to open a long-running binary connection to a server application from a web page. I should be able to push data from the server to the client at frequent but arbitrary intervals and have it arrive fairly quickly (so HTTP GET polling is probably inadequate). I want to be able to unpack and decode the binary data on the client side, not change the server to use a different protocol, as the servers already have their own protocols that they follow.
If necessary, I can insert a proxy application that can translate between browser and server, but I want that to be as minimal as possible. And the server, or this proxy application that talks to the server, can be on the same domain as the web page, if that affects the security model.
I'm aware of the likes of Socket.IO, which appears to be close to what I want, but it's hard to tell what the capabilities and restrictions are. I also know this would be fairly easy with a Java applet but I would prefer a solution that doesn't require a plugin (or only requires Flash, at worst, but I still want to do most of the work in Javascript ideally).
Also, cross-platform availability is important - if I can reach 70% of desktop browsers that's fine. Not bothered about ancient browsers though - I don't mind compelling a user to upgrade, just not to install something new. It would also be great if it works on iPhone and Android too.
What are my best options?
Upvotes: 2
Views: 424
Reputation:
A Flash applet using XMLSocket is probably your best bet, unless mobile compatibility is important. It places some constraints on the format of the data you can send (all data is sent in NUL-delimited packets), but that's easy enough to proxy if necessary.
Upvotes: 1