Home

Awesome

Atmosphere WebSockets Samples for for Jersey, Jersey2, GWT, JavaScript, JQuery, Netty, Guice, Spring, RMI, RabbitMQ, Redis, Hazelcast, JGroups, jsr 356, Sockjs, Socket.IO, JMS, Vert.x, Play Framework, Java EE, Tomcat, Jetty, Undertow, JBoss, etc...

One sample to rule them all!

The table below describes every Atmosphere's sample by defining the server and client API used to build it. You can download the sample by clicking on its name or clone the workspace, build it and then do

  mvn jetty:run

or

  mvn tomcat7:run

Recommended samples for getting started are the chat, which demonstrate usage of all transports using an AtmosphereHandler, or the jquery-pubsub, which demonstrate how to switch from one transport to another using a Jersey Resources. If you are interested to write WebSocket only application, take a look at the atmosphere-websockethandler-pubsub sample. The pubsub sample contains a lot of small demonstration on how the Jersey extension can be used. If you are interested to write HTML5 Server Side Events application, take a look at the atmosphere-sse-xxx samples.

If you plan to use Spring or GWT, take a look at their specific samples.

[Analytics]

<font color="green">All sample supports WebSocket and Long Polling by default. Streaming and JSONP are supported by the majority of pubsub samples. If you are interested to write HTML5 Server Side Events application, take a look at the atmosphere-sse-xxx samples.</font>

Sample NameDescriptionServer ComponentsClient Components
all-api-pubsubThis sample implements a pubsub example that demonstrates all Atmosphere's API and extension. The use of AtmosphereResource, Meteor, Annotation like @Suspend and @Broadcast are demonstratedAtmosphereHandler Jersey Resource Meteor WebSocketProtocolSingle Callback supporting WebSocket, Long-Polling, JSONP, Http-Streaming
async-annotation-pubsubThis sample demonstrates the use of the @Asynchronous annotation combined with the Callable API, showing how an application can be fully asynchronous in its execution. The sample implements the pubsub concepts.Jersey ResourceSingle Callback supporting WebSocket, Long-Polling, JSONP, Http-Streaming
atmosphere-ee6This sample demonstrates the use of @Suspend with Java EE's 6 annotation like @Resource and EJB TimerJersey ResourceHttp-Streaming
channelThis sample demonstrate the use of @Subscribe and @Publish annotation using a pub sub application. If you are migrating from CometD, this sample is for you.Jersey Resource
chat-guiceThis sample demonstrate the use of Google Guice with Atmosphere. The Chat application is implemented using @Suspend and @Broadcast annotationGuice Jersey ResourceJavascript Functions demonstrating WebSocket, falling back to Long-Polling
chatThis sample demonstrates the use of WebSocket (falling back to SSE and Long-Polling) using the @ManagedService annotation. The sample also demonstrates how to detect which transport are supported by the client and server by negotiating with the server.ChatJavascript Functions demonstrating WebSocket, falling back to Long-Polling. This is the recommended sample to start with.
chat-multiroomThis sample demonstrates the use of WebSocket (falling back SSE and to Long-Polling) using the @ManagedService annotation with Encoder and Decoder. The sample also demonstrates how to detect which transport are supported by the client and server by negotiating with the server.ChatroomJavascript Functions demonstrating WebSocket, falling back to Long-Polling. This is the recommended sample to start with.
cxf-chatThis sample is similar to the chat sample but uses Apche CXF as its REST framework.ChatResourceJavascript Functions demonstrating WebSocket, falling back to Long-Polling.
cxf-chat-osgiThis is similar to the OSGi version of the cxf-chat sampleChatResourceJavascript Functions demonstrating WebSocket, falling back to Long-Polling.
cxf-greeter-swaggersocketThis sample demonstrates the use of SwaggerSocket (REST on WebSocket) using Atmosphere's SimpleRestInterceptorDefaultApiJavascript Functions demonstrating SwaggerSocket.
di-guice-sampleThe sample demonstrates the use of Atmosphere's Dependencies Injection using GuiceJersey Resource GuiceJavascript Callback
jersey2-chatThis samples demonstrates the use of JAX RS Specification 2 with @AtmosphereServiceJersey ResourceJavascript Functions demonstrating WebSocket, falling back to Long-Polling
atmospherehandler-pubsubThis sample demonstrate the use of AtmosphereHandler for implementing a pub sub application. The sample supports Long-Polling, Http Streaming and WebSocketAtmosphereHandlerJavascript Function
atmosphere-meteor-pubsubThis sample demonstrate the use of the Meteor API, from a Servlet, for implementing a pub sub application. The sample supports Long-Polling, Http Streaming and WebSocketMeteorJavascript Function
jquery-multirequestThis sample demonstrates how multi requests can be made using the jQuery.atmosphere.js. The sample implements the pub sub application.Jersey ResourcePer Request and Global callback
jquery-pubsubThis sample demonstrates all transports (WebSockets, Server Side Events, Long-Polling, Http Streaming and JSONP using a super simple Jersey Resource. The sample implements a pub sub application.Jersey ResourceJavascript Function
jquery-websockethandler-pubsubThis sample demonstrates how to write WebSocket only applicationWebSocketHandlerJavascript Funtion
jquery-pubsubThis sample demonstrates a lot of server side functionality like broadcast/suspend/resume using a Jersey Resource.Jersey Resource
meteor-chatThis sample demonstrates of the Meteor API, from a Servlet, can be used to implement a chat applicationMeteorJavascript Function
meteor-pubsubThis sample demonstrates of the Meteor API, from a Servlet, can be used to implement a chat applicationMeteorJavascript Function
rest-chatThis sample demonstrates the use of a Jersey Resource for implementing a chat applicationJersey ResourceJavascript Function
scala-chatThis sample demonstrates how to use Scala to write a chat applicationScala ResourceJavascript Function
spring-tilesThis sample demonstrates how to use the Spring and Tiles Framework with AtmosphereHandler. The sample implements a pubsub applicationSpring ControllerJavascript Function
spring-websocketThis sample demonstrates the use of Spring with Atmosphere WebSocketHandler, Meteor and AtmosphereHandlerMeteor Service WebSocketProtocolSpring View
sse-chatThis sample demonstrates how to use HTML 5 Server Sides Events to build a chat application using an AtmosphereHandlerAtmosphereHandlerJavascript Function
sse-rest-chatThis sample demonstrates how to use HTML 5 Server Sides Events to build a chat application using a Jersey ResourceJersey ResourceJavascript Function
twitter-live-feedThis sample demonstrates how to use jQuery.atmosphere.js to implements a real time Twitter Search using a simple Jersey Resource. It also demonstrate how BroadcastFilter can be used to mark to handle large set of data to send back to the clientJersey ResourceJavaScript Function
socketio-chatThis sample demonstrates how the SocketIO library can be used, trsnaparently, using an AtmosphereHandlerAtmosphereHandlerSocketIO
native-socketio-chatThis sample demonstrates how the SocketIO library and natively extending the SocketIO protocol on the server sideAtmosphereHandlerSocketIO
cometd/bayeux protocolThis sample deploy the Cometd official demo on top of Atmosphere
websocket-chatThis sample demonstrates how to write WebSocket ONLY applicationsWebSockerHandlerJavaScript Function
websocket-streamThis sample demonstrates how to write WebSocket streaming applicationsWebSockerHandlerJavaScript Function
gwt2-jersey-rpcGWT RPC with JerseyServerClient
gwt20-jsonGWT with JSONServerClient
gwt20-managed-rpcGWT RPC using the @ManagedService annotationServerClient
gwt20-rpcGWT RPC using the an AtmosphereHandlerServerClient
gwt20-websocketsGWT client websockets using com.sksamuel.gwtwebsocket-streamClient

Note that for those samples using jQuery, version 2.x is used and they are not compatible with IE 6, 7, and 8. Try other browsers. For more information, see https://jquery.com/browser-support/