Using HTML5 Websockets with Spring
I'd like t开发者_如何学编程o use Websockets with a Spring MVC-powered web app. I've read o jWebsockets and bristleback, but I am wondering if that is the best way to integrate. I am sure someone has done this before and has some tips what works and what does not...
Thanx!
since Springframework 4.0 M1 Websocket are supported, see http://blog.springsource.org/2013/05/22/spring-framework-4-0-m1-websocket-support/
Edit - 08 january 2014: Springframework 4.0 released and supports websocket, have fun.
Here is an update on 4.0 M2, see http://blog.springsource.org/2013/07/24/spring-framework-4-0-m2-websocket-messaging-architectures/
Spring MVC will offer you no help here - it supports HTTP traffic using the Servlet and Portlet APIs only. Websockets, I believe, are not HTTP-based.
Spring has plans to implement the WebSocket servlets offered by many popular application servers. The main problem is that, as each server comes out with it's own webscocket implementation, they all vary greatly. The Atmosphere Framework is available, and supports cross server, cross browser implementations.
There are some blog posts available, like combining atmosphere websockets and comet with Spring MVC
I would suggest you research the framework before deciding it's right for you. They have a github src repo with demo's and documentation available as well.
It seems that support is planned, https://jira.springsource.org/browse/SPR-9356 (but they'll need to work around the lack of Servlet API support)
精彩评论