NettoSphere: A WebSocket and HTTP server based on the Atmosphere and Netty Framework
Introducing NettoSphere, A Java WebSocket and HTTP server based on the Atmosphere and Netty Framework. NettoSphere easily allow the creation of WebSocket and/or Comet applications. This blog will quickly demonstrate how simple and fast it take to build WebSocket application.

If you don’t know what is Atmosphere, take a quick look at this blog.
NettoSphere supports all Atmosphere API, which means you can write REST style application via Jersey or pure AtmosphereHandler. You start the server by doing:
val server : NettoSphereServer = new NettyAtmosphereServer.Builder.config( new Config.Builder() .host("127.0.0.1") .port(8080) .resource(classOf[MyWebSocketEchoProtocol]) .build) .build.start
As an example, you can write bi-directional WebSocket application by adding the following WebSocketProtocol:
class MyWebSocketEchoProtocol extends WebSocketProtocol with Serializable { override def onOpen(webSocket: WebSocket) { logger.info("Client's connected {}", webSocket.resource.getRemoteAddr ) } override def onMessage(webSocket: WebSocket, message: String) { webSocket.write(message) } }
Now client wise, any WebSocket library will works (like the jQuery.atmosphere.js, wCS or AHC), or using bare metal WebSocket API
function showMessage(text) { document.getElementById('message').innerHTML = text; } var ws = new WebSocket('ws://' + document.location.host + '/echo'); ws.onopen = function() { showMessage('Connected!'); }; ws.onclose = function() { showMessage('Closed'); }; ws.onmessage = function(msg) { showMessage(msg.data); };
That’s it. That doesn’t have to be complicated!! For more information, go to the NettoSphere main page or ping me on Twitter!

I hope this is the correct forum.
I’ve been trying to post to the nabble atmosphere forum, but keep getting rejected although I’ve tried to join the mailing list.
I am quite excited about your nettosphere subproject. I would like to try it out. It looks powerful and just what I need (much better than writing it myself!)
Unfortunately, the 1.0.0 SNAPSHOT release is not actually available as linked from your nettosphere main page on github: https://oss.sonatype.org/content/repositories/snapshots/org/atmosphere/nettosphere/1.0.0-SNAPSHOT/
I found the 1.0.1 SNAPSHOT folder, but your directions for running from java command line do not work in this version.
C:\netty\nettosphere>java -cp nettosphere-1.0.1-20120303.032622-8-all.jar org.atmosphere.plugin.netty.NettyAtmosphereServer C:\netty\nettosphere\nettosphereTest localhost 8080
Exception in thread “main” java.lang.NoClassDefFoundError: org/atmosphere/plugin/netty/NettyAtmosphereServer
Caused by: java.lang.ClassNotFoundException: org.atmosphere.plugin.netty.NettyAtmosphereServer
at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
at java.lang.ClassLoader.loadClass(ClassLoader.java:307)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
at java.lang.ClassLoader.loadClass(ClassLoader.java:248)
Could not find the main class: org.atmosphere.plugin.netty.NettyAtmosphereServer. Program will exit.
Can you help me get this project up and running so I can experiment with it? Or direct me to how I can actually join the help forums?
Salut, the pacakge name is org.atmosphere.nettosphere.NettyAtmosphereServer (typo in your cmd line). Thanks!
I wrote a sample here: https://github.com/nchandra/NettosphereSample
Jean Franc,
My apologies for having this post out of topic but I would like to grab your attention for a few minutes regarding an Atmosphere issue.
I have an example that it is giving me some issues. It works fine with Firefox but it is failing in Chrome. I think it is a Chrome issue but I would like you to have a look in it before anything else.
Please download the following test ear:
https://riaconnection.files.wordpress.com/2012/04/atmo-issue.doc
Rename it to .7z and use 7-Zip to expand it (http://www.7-zip.org/).
Drop it on JBoss 7.1 Final: http://www.jboss.org/jbossas/downloads/
Browse to http://localhost:8080/atmo and click the button several times. You’ll notice that Atmosphere messages are being used to notify the browser on the change of state of the image. If you then click on any of the “break it” links you’ll notice that any further interaction with the button will no longer change the state of the image since that no further Atmosphere messages will be received by Chrome.
Thanks
I tried running the sample nettosphere app by starting teh netty server internally and tehn deploying it as a part of war in jboss server. But unfortunately on server.start for netty it gives the below exception..
java.lang.NoClassDefFoundError: org/atmosphere/nettosphere/Nettosphere$Builder
Can someone help me on this.
Thanks in advance!
run demo in the netty server internally.
and what’s the url to visit index page?
like: http://localhost:8080/