Wednesday, July 18, 2012

Setting up SSL for netty-socketio / ColdFusion gateway

So I was disappointed to learn that my beloved netty-socketio package couldn't do SSL stuff out of the box. Very disappointed! My customer requires the use of SSL which means I can't release my fantastic capability without it. Except we must remember that I am not very good with the whole Java thing. I officially finished my Java classes 4 years ago now and have only used it one time since then (and that was a fantastic disaster!) So I was not looking forward to trying to piece together the code I'd need to make Netty/SSL work with netty-socketio. The stupid thing is I forgot exactly how Java uses the extends functionality. (Not inherits, even though I should use it... I am just trying to get stuff working at this point.)

I originally thought I had to build out this big structure overriding entire objects from netty-socketio just to get it maybe-kinda-sorta working. Turns out I didn't need to do any of that. I just had to extend the, and files, in addition to adding the file from netty's example pages. Turned out to be not that bad (so far). I really am just extending a few functions here and there to include the necessary links to the SSLContext object and HOPEFULLY it will work. It is at least failing where it's trying to pull the certs, which is where it should be failing. I'll have more tomorrow (once I figure out how to get Java's certs playing nice with everything else.) Looking good!

Wednesday, July 11, 2012

The pains of releasing code under Government development contracts

So I officially have something I could release for ColdFusion and Unfortunately I cannot (yet). Due to the nature of the contract I work under, I am bound by some fun rules that require not just my customers approval, but his bosses approval as well. And then after that I have to get approval from the contracting officer who is over our contract to get it release. I have to prove that it doesn't impact the government negatively to get their approval.

Should be easy right? Only 1000 lines or so of code and it supports messages, events, and JSON objects. Works pretty well with a few oddities tossed in there (of course). I'll try and release it ASAP but it's not going to be soon. I'm telling all those 3 people who happen to have come across my blog ;).

Tuesday, July 10, 2012

Functional ColdFusion Gateway for Socket.IO

So I got my ColdFusion Gateway working pretty nicely with Socket.IO. I have a sample running via Chrome, Firefox, and IE and it's going from the Socket.IO js package on the frontend to the netty-socketio package that I previously mentioned, to the CFC I built, and right back out. I tested it and I can send messages to specific users as well as broadcast to all users. I can send string messages as well as Json objects. Seems to do what I need it to do for now. I broke it out from the original cf-websocket-gateway package that I used as inspiration so that depending on the message type it will call a different function. I really only plan on using the Json message but figured I'd push it a little bit for those who might be interested in other functionality.
Speaking of which, I am trying to get my customer to allow me to release my package as an Open Source project to maintain. It's nothing fancy but I think it would help a number of ColdFusion users out there who want to try some new/cool stuff with WebSocket and Socket.IO. I know I am! My next task is to create a nice and modular ExtJS store plugin that can push store updates to all users who are connected. It would be a useful tool when having a large grid that needs to be refreshed from multiple users (who wants users to overwrite each others' data?) or even chart data like a stock market ticker (note to self, that'd be a perfect example to build!)
So that's my plan. I will try and release what I have to the outside world and I'll continue to develop some additional components to help interface with what I put together. Should be fun! Maybe one day I'll even get users looking at what I've done. Hah. We'll see.

Friday, July 6, 2012

Progress on ColdFusion and Socket.IO

So I've been working on the Socket.IO implementation that has been released previously for a java package and netty. It's been extremely frustrating since I'm not a Java developer and the documentation for ColdFusions gateway stuff is CRAP. That and there doesn't seem to be any way to debug gateways AT ALL when they are running so I'm just walking blindly through the whole freaking thing, compiling stuff and pushing it to see if anything changes. Awesome.
Well in spite of all that, I was able to get some freaking connectivity going! I currently have it running as a gateway service in CF but it isn't actually tapping into any CFC's or anything like that, but it's at least RUNNING now. I have the WebSocket service just posting anything to everybody and I have to windows passing stuff back and forth at least so there is that. Now if I can get the cfc's to start working we'll be making some serious progress!

Tuesday, July 3, 2012, 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 due to the fact that it can fail gracefully to other technologies to simulate such communication. Awesome! Except for the fact that 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 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 This newer one seems more compatible with the latest 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 with this netty-socketio package on the backend. Awesome. The joys of trying new things out but being restricted by your current setup.