Tuesday, July 3, 2012

Socket.io, sounds great unless you don't use node.js

So when looking at utilizing WebSockets and all that exciting technology, I was really psyched about using Socket.io due to the fact that it can fail gracefully to other technologies to simulate such communication. Awesome! Except for the fact that Socket.io uses a different protocol when pushing/pulling data that needs your webserver to be customized to support it. Assuming your webserver even supports WebSocket stuff. It just so happens that ColdFusion 9 does not. Of course. So after much searching I found cf-websocket-gateway which seemed like it'd get the job done! It's based on webbit and netty at the moment which seems fine to me. I was able to get the test cases running smoothly but then when I tried using socket.io instead of the included WebSocket piece it freaked out on me (shock of shocks, it requires node.js to work nicely). That's when I found out that it used that super-special protocol to make magic happen. Back to the drawing board.
I have come across a new project called netty-socketio (not to be confused with socket.io-netty). This newer one seems more compatible with the latest Socket.io protocol (.6-0.9.3 at this writing) and is based on netty (which cf-websocket-gateway is based on in a roundabout fashion) but of course does not include the gateway wrapper to integrate with CF 9. So now I can either write the wrapper myself (which doesn't seem so bad, I just haven't used Java in a few years) or just stick with this other WebSocket js package that hasn't been updated in quite a while and I'm pretty sure only uses the Flash fail-over or the browser-based method of WebSocket compatibility.
I think my plan is to write an ExtJS wrapper around this other package with the eventual plan to migrate to Socket.io with this netty-socketio package on the backend. Awesome. The joys of trying new things out but being restricted by your current setup.

No comments:

Post a Comment