GlassFish OSE 3.1 is out with WebSocket support included

By now you likely know that we released 3.1 of GlassFish today.  It's all over twitter with much of the jubilation around the return of clustering and HA support.  But closer to my own heart is the inclusion, finally, of websockets support.  I've blogged about it before, so I won't go in to too many details here.  But this is the first actual release of GlassFish to feature support for it which I'm personally pretty excited about. Some caveats still apply, however.  WebSockets are an exciting new technology but still remain under active development.  The version of the specification shipped with GlassFish 3.1 is the -76 version which is rather old by now.  It is still, as of this writing at least, the version supported by most of the browsers that support websockets.  So the good news is that apps you write today should work with most of the browsers out there.  As the specification evolves, however, browsers will begin to support newer versions of the specification and the GlassFish code will no longer work.

In the grizzly source tree, I have implemented support for the -05 version of the specification (with work started on the -06 version) for the 1.9 tree (which ships with GlassFish).  Should you find yourself needing newer support, I have written a simple bash script that will do that heavy lifting for you.  The script below needs to be run from the glassfish3/glassfish/modules directory.  In addition, you'll need to specify the version of grizzly you'd like to upgrade to.  The -05/-06 support will be present in 1.9.33 release coming up soon.

#! /bin/sh

if [ -z "${NEWVER}" ]
	echo Please specify the new version as a parameter

asadmin stop-domain
for i in grizzly-*
	[ $? -eq 0 ] && mv -v ${DEP}-${NEWVER}.jar $i

rm -r ../domains/domain1/osgi-cache/felix/

asadmin start-domain

This script will download the artifacts we've pushed to maven and update your existing grizzly jars.  It will also stop and restart your glassfish server for you so you don't need to worry about that.  The -05 spec is not compatible with the -76 version shipped with GlassFish 3.1 and we do not support the -76 version in the newer code for a variety of security/sanity related reasons.  So know that once you upgrade, you'll need browser support for the new version or your apps will stop working.

A word of warning, though.  I've done this locally and it works just fine.  But, as with any patch, you should back up your GlassFish directory first and/or test it in a development environment first.  If you have a support contract with Oracle, you'll likely need to discuss with them first to see how it would impact any agreements you have.  Ominous as that may sound, this should be safe enough to do (especially for a development environment) but just consider yourself warned.

WebSocket support is evolving constantly along the protocol itself.  While API changes are kept to a minimum, as we upgrade our support for the newer specifications and you upgrade your system to support them, you might encounter various changes in the API.  I really try to minimize such changes but please understand that things can change from release to release as everything beings to stabilize over the next few months.

I'm working on a number demos to help you get started with your own applications.  I'll be sharing a handful of those and presenting on building websocket applications at next month's The ServerSide Java Symposium in Las Vegas.  I'll be covering development using both 1.9 (and GlassFish 3.1) as well as grizzly 2.0 which just went final as well.  If you're there, please stop by and say hi.  I'd be happy to try to answer any questions you might have.