Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Spring 4 Websockets vs other websockets frameworks with fallback options.  RSS feed

 
Kent de Guzman
Greenhorn
Posts: 14
Java MyEclipse IDE Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi guys.
I'm planning to create a simple multiplayer games with websockets.
My goals are:
-can be play on mobile, should be lightweight.
-it should have fallback options in case browser doesn't support websockets.
-can integrate with Spring.


Frameworks that I researched so far are :
1. Spring 4 Websockets with Stomp and SockJs
2. Atmosphere
3. Netty
4. jWebsockets
5. Resin?

What is the best framework for this? What are the pros and cons of using them?
Suggestions would much be appreciated.
Thanks.
 
Jayesh A Lalwani
Rancher
Posts: 2762
32
Eclipse IDE Spring Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Adding this thread to the sockets forum

I've not played with all those libraries. I've only worked with netty. IME netty is awesome if you wanna go really low level. It's little hard to work with though. However, it gives really good performance. I would go with netty only if you are hyper focused on performance.
 
Kent de Guzman
Greenhorn
Posts: 14
Java MyEclipse IDE Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
@Jayesh Thanks. Netty is actually my first choice since one of my focus is a good performance even though I think it will give me a hard time. Netty also support Spring. Do you think netty support automatic fallback options?
Example would be from websockets to long polling in case browser doesn't support websockets.
 
Jayesh A Lalwani
Rancher
Posts: 2762
32
Eclipse IDE Spring Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You'll have to implement the handshake yourself or find some code that has the implementation. Websockets supports fallback to normal http. If the client sends a websocket header, you are websocket, otherwise you are http.

So you can do it in netty. It's just going to be very clunky. In netty, you basically have a chain of handlers. Which means its not simple to handle different requests differently. Each handler will need to know whether to handle the input or just pass through. Google for a sample on how to implement handshaking in netty and you will see.

The performance benefit might not be huge. We are talking about tenths/hundredths of milliseconds. Depending on what you are doing at the app layer, this optimization may not be worth it.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!