Wednesday 5 June 2013

ColdFusion / Railo WebSockets survey results

G'day:
I didn't get much interest in the "ColdFusion / Railo WebSockets: do you use 'em?" survey as mentioned in my article the other day. Not to worry. I think that speaks for itself in a way: plenty of people looked at the article, but not so many figured it was worth their while / interest in filling out the survey.

I only got 24 responses, but here's the breakdown of those I got.


Firstly I asked "How interesting / significant do you consider WebSockets to be in the context of ColdFusion/Railo?", which garnered this reaction:



I've colour-coded this to reflect the red end of the scale shows increasing lack of interest, and the green end an increasing sense of importance. And the beige people are non-committal. It's fairly well spread across the spectrum. Almost half of people think they're a good addition to the language (to some degree or another).

My personal vote here was a "neither here nor there". I think WebSockets are OK, but I can't get excited about them as I don't (or didn't...) see many use cases for them. No-one seems to be clamouring for them as part of a solution.

Next up I asked whether "you/have you used the WebSockets implementation in ColdFusion and/or Railo". This is to distinguish between people who know about them and have used them in a real-world situation, and who has just messed around with them. I am a "haven't used at all", for this one. The break down was:

ColdFusion:4
Railo:1

So only five people have used 'em. I guess that's 20% of the sample size, so that's not bad actually.

Now I get onto the potentially meatier responses of what people are using them for in production: "What sort of functionality have you implemented using WebSockets? (if you have github, gist or pastebin links, so much the better!). Please only list actual real-world, in-production or destined-for-production situations, not imaginary or figurative ones."

There were ten responses to this (I was expecting a maximum of five... the number of people who responded to the preceding question, but I got a few people with variations of "no", "none", etc.  What did people say:

Maintaining a constant link to student during e-Learning Exam for timer/session purposes.

There are lots of practical uses for web sockets. They can be used anywhere you would normally do a ajax heartbeat. I have written 2 non-chat apps with websockets.. This was just a game I made to play with the tech. Crappy code but useful web socket example. http://blog.dkferguson.com/index.cfm/2012/2/17/ColdFusion-10-WebSockets-Demo-App This is a lot more useful. I have been working on a new version that is fw\1 enabled and handles things better. I hope to release it soon. http://blog.dkferguson.com/index.cfm/2012/3/13/Websockets-demo-Log-Watcher

We are developing an Android/iPhone app for one of our brands and we'll be using websockets to push messages to the app from our CF powered website to alert subscribers in real-time. There are currently 200,000 email subscribers and 100,000 might switch to using the app. If we use old fashioned polling technology then that many clients/apps polling our servers every 5 minutes could kill it. Websockets seems like the only solution to limit user's bandwidth and our server resources.

I actually use it for Chat applications.

Mostly messaging


OK, so people actually are using it for messaging / chatting in the real world as well as in code samples for blog articles ;-)

Dave's answer is interesting here. I've not looked at his links yet, but will do so when I have a bit more time (as per usual with these articles, I'm against the clock a bit with this). He's clearly put a bit of effort into his investigations.

And interconnecting WebSockets and mobile apps is something that sounds like a great idea that had not occurred to me. One question that crops up here (and this was something my colleague Simon and I were discussing yesterday), is how well do WebSockets on ColdFusion scale? Has anyone tested heavy usage? I don't so much mean in the context of throughput, but more in the context of maintaining the connections to the clients? Doing that must consume some resource or other (you can tell how ignorant I am on this topic as I really don't know how it works). One reason web sites  can handle a lot of load is that once a request is done with, that's the end of it, so the resources to serve it are not tied up for very long, and can busy themselves with subsequent jobs. This doesn't seem so with a WebSocket connection.

One interesting non-practical response was:

None, can't think of a real world use that would be worth the effort.

This is interesting because one thing I've already thought about ColdFusion's WebSocket implementation is that it seems pretty easy to use! Although I must add that this is almost all theoretical so far: reading, and copying in some sample code from the docs (which, suprisingly, worked without adjustment). So perhaps the person has a low "effort" threshold? Or perhaps I'm wrong, and it's all a nightmare. I guess I will find out over the coming days / weeks when I investigate further.

There were a couple of comments against the original article too, which I'll reproduce here:

Jeff commented:

I actually use websockets for the much maligned chat app. Once Facebook removed the group chat feature we needed a quick fix for a film group that watched films together from anywhere in the world. I retrofitted Ray's chat demo and now every other weekend, we have a group that chats as we watch a predetermined film on DVD. Another real world example we are looking into at work is a chat with a customer service rep.
Tim gave a good link in his comment:

Hey Adam, Just read a really good article today that lists the top 10 realtime web applications: http://www.netmagazine.com/features/top-10-realtime-web-apps - The one that caught my attention is http://firepad.io which is an open source project that allows for collaborative text editing, would be cool to see the project implemented with Coldfusion websockets :{D

I'll be looking there for inspiration.

Gavin and Dave both alluded to the presentation Dave did at cf.Objective() (and a good presentation it was... it's partly what got me thinking about doing this investigation). Gavin's comment:

Dave Ferguson's Fuse the greatness talk at CF Objective was pretty good. Using websockets and zingcharts and scheduled tasks together, to build a server dashboard, to watch your processor, requests, etc... kinda cool.
I think its works well for that type of thing, but a lot of people have complained about the internet connections being messed up and stranded children everywhere with websockets.
Yeah, I was talking to someone after the presentation (was it Adam Tuttle?) and they mentioned that in the real world, WebSockets can be a bit flaky as routers can drop their connections (because the routers are geared for HTTP requests, rather than keeping connections open). On the other hand they're pretty stable within a private network. This is perhaps something to check out before committing to anything "mission critical" using WebSockets over the internet.

Phillip gave me a link to bombermine.com. Cool!

And Matt suggested this:
Local node js group demo'd a quiz, where 10 people connect on their phones and click the answer etc
That's pretty cool.

The fourth question was "What other uses for WebSockets technology can you think of, but haven't had opportunity to implement?" And what did people have to say (I've omitted the ones that said "none" or variations thereof:

Real-time Session Variable sharing between JavaScript and ColdFusion for HTML5/JS Apps.

We have multiple data loggers for temp, humidity, and dew point that we currently use a third party program to read every 60 seconds and insert the results into a db. I have been wanting to experiment with CF web sockets for this (Railo - not doing anything new in ACF). Basically all we do is send a command that says "What is your current data?" and the loggers report their current data.

Using it in conjunction with single page apps to provide instant dom updates when the back-end model changes is something that we are discussing for one of our apps. The app in question is an order/contact management system in which leads, new orders, inventory levels, special bulletins, etc... could feasibly be passed to the client (single page angularJS app, but could be any front end) in realtime via websockets. Currently you'd have to rely on a timed interval function that would ping the server every x minutes to get this data.

Logging/Monitoring

Nothing for good, I can only think of evil plans...
Chuckle.


Live stats on an application dashboard. Graphs flowing and such.

Gaming, live updates for admin areas

Customer services online comms


So telemetry monitoring seems to be something one could use WebSockets for. This is an intriguing idea, and one that could get real world usage. And the general "single page app" model also sounds like it could leverage WebSocket communications quite nicely. That could be cool. Ray also added an interesting comment to the original article:

Another example, and this is possibly not 100% practical or useful very often, is 'group' presentations. One person 'drives' the slide deck and the view on everyone else's machine advances along with them.
I think this is a good, practical idea. And just because one might not use it very often (I think this sums up WebSockets in general), this doesn't invalidate it.

Finally - in the survey - I asked for comments:

There's definitely room for web sockets, but in our day to day building standard sort of websites I haven't had a need for them.

They seem cool, but I've just never needed to use them. I've tended to work on sites with fairly static data though and not real-time stuff.
Another thing Simon and I talked about yesterday was that perhaps the nature of how web sites have worked has meant that if a need for this sort of thing ever arose, it was dealt with another way, and so "the way things are done" kinda reduce the perceived need for this sort of server-pushed communication. Because we've traditionally not had it, we've just learned to do without. Perhaps an unlearning exercise is needed.

It seems like I did this in java a few years ago, but the other developers we had at the time balked at using anything other than CF, as they did not want to take the time to understand what was going on. Heck, I even had a hard time convincing them to let me use javascript for some processing on the client side (that should have definitely been client side) as opposed to doing everything server side. Those days are now gone, and I have control over how we approach solutions. That also means I have less time for experimenting with the cool stuff.

Only ever used to test new features but never come across a real world use.

I think that web sockets are a great technology. Now that all recent versions of browsers support it the adoption may rise. But, this is one piece of tech that is missing that "WOW" demo app what will make people really pay attention to it.
I think this is it. Adobe really ought to have come up with something better than the obligatory proof-of-concept-quality examples.


I question the amount of memory it might take up on the server to have 100,000 subscriptions or more. I have no idea how to test it with that many so it's a bit scary putting it into production as it might be a drain on memory and CPU.
Yeah, this is what I touched on above (this might be Simon replying to the survey, for all I know).


The Railo extension was created ages ago and hardly anyone made a fuss about it. Adobe made a huge fuss of adding web sockets to CF10 that it smacks of a marketing "me too!".
I dunno about that. I think the reason no-one makes a fuss about anything in Railo is because their marketing budget is small (or non-existent), and would have been even smaller a coupla years ago when this third party extension came out. It's not really for Railo to market third-party add-ons. On the other hand, it seems entirely reasonable for Adobe to market the features they make a point of adding to the language. WebSockets was one of the more interesting additions to CF10, even if perhaps not a "killer" feature. So "interesting" features are easy to market to the industry. However we don't really need to make a competition out of this, do we?


Dave Ferguson has a good presentation on this from the CFMeetup group site.

Would looking in to nodejs examples give us more ideas of ways to use websockets?

This is a good thought. I might use this approach as a source of inspiration.

Whilst WebSockets seem very powerful I imagine they are a very niche feature which few have a use case for. Unless the project was sponsored by some large Corp it seems a waste of Adobe engineering resources to implement. A solution looking for a problem?
Possibly...


Haven't yet used them because we never upgraded to CF10 (Standard edition has become even more crippled to justify the cost and upgrading to Enterprise since we're planning to abandon ACF) and we don't yet use Railo in areas where we'd have a need for them. That will probably change once we begin the company-wide transition from CF9 to Railo 4.
Ah yes, this is another barrier to their adoption. I didn't think about the licensing issues here. I presume the ColdFusion code simply wraps up some Java library though, so perhaps that's a more cost-effective way of being able to use 'em?


Don't use them currently, don't expect to use them in the future, know very little about them.

vive la France
Yes, thank-you Andrew ;-)
(this is a reference to this Twitter exchange about NZ v France in the rugby on this coming Saturday)


I've tried to think of good uses to put them to, but have so far drawn a blank.


Good feedback.

I've copped-out a bit in this article: I've offered-up everyone else's opinion, but my own one is still in reserve. This is mostly because I've had no further opportunity to look into WebSockets, so just feel very thick when it comes to the topic. Not that that (ie: being thick) has ever stopped me wittering on about a topic before, but I want to do more investigation before I comment further with my own findings. I do have an article in progress detailing my own progress / experimentation with getting a WebSocket example working, but I haven't had any time to dedicate to it recently.

As a closing note, perhaps if you are one of the bods who has done a real-world chat solution, you might be able to help a person on Stack Overflow who is trying to do same, and is struggling slightly. I meant to quickly get up to speed and help them out, but I am just not finding time.

I must now give myself a haircut, and head to the airport. Scotch on the Rocks is beckoning...

--
Adam