-
-
Notifications
You must be signed in to change notification settings - Fork 751
Understanding the Atmosphere Protocol
Jeanfrancois Arcand edited this page Oct 9, 2013
·
10 revisions
The Atmosphere Framework uses a really simple communication protocol between its supported client and the core server component. By default, atmosphere.js attach, to the request URI, a list of query string that are used by the core server component. It can also set those value as requests headers if required. If you are planning to write an Atmosphere enabled client, the mandatory keys/values are:
- X-Atmosphere-Framework = version The lowest Atmosphere's version supported
- X-Atmosphere-Transport: sse|websocket|long-polling|streaming|ajax|jsonp The transport used for that connection.
- X-Atmosphere-tracking-id: value Originally set to 0, this value will be set by the server in order to uniquely track the client and sent back as a response's header of the same name.
- _timeStamp A unique value starting with _ . This is required to prevent browsers/proxy from caching request.
- X-atmo-protocol Set to true so the server will send back the X-Atmosphere-tracking-id and X-Cache-Date on the first request so all transactions occuring after have the proper value.
For example, a request may looks like
T 127.0.0.1:57618 -> 127.0.0.1:8080 [AP]
GET /chat?X-Atmosphere-tracking-id=e24de98c-6624-c552-5572-6edbffd270e3&
X-Atmosphere-Framework=1.0&X-Atmosphere-Transport=long-polling&X-Cache-Date=134183423411
&_=1341834834155 HTTP/1.1.
Host: 127.0.0.1:8080.
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.7; rv:13.0) Gecko/20100101 Firefox/13.0.
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8.
Accept-Language: en-us,en;q=0.5.
Accept-Encoding: gzip, deflate.
Connection: keep-alive.
Referer: http://127.0.0.1:8080/.
When the client is closing the connection, the following message will be sent:
T 127.0.0.1:54684 -> 127.0.0.1:8080 [AP]
GET /chat?X-Atmosphere-Transport=close&X-Atmosphere-tracking-id=b87815c9-3f3d-4fef-8f44-1e85c9156e43&_=1373382436869 HTTP/1.1.
Host: 127.0.0.1:8080.
Connection: keep-alive.
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_8_4) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/27.0.1453.116 Safari/537.36.
Content-Type: application/json.
Accept: */*.
Referer: http://127.0.0.1:8080/.
Accept-Encoding: gzip,deflate,sdch.
Accept-Language: en-US,en;q=0.8.
Cookie: nikio.guid=2e87c963-0668-4e2f-8e91-63c2eb759558; hudson_auto_refresh=true.
- X-Atmosphere-Transport: close
- X-Atmosphere-tracking-id: the value received first.
- Understanding Atmosphere
- Understanding @ManagedService
- Using javax.inject.Inject and javax.inject.PostConstruct annotation
- Understanding Atmosphere's Annotation
- Understanding AtmosphereResource
- Understanding AtmosphereHandler
- Understanding WebSocketHandler
- Understanding Broadcaster
- Understanding BroadcasterCache
- Understanding Meteor
- Understanding BroadcastFilter
- Understanding Atmosphere's Events Listeners
- Understanding AtmosphereInterceptor
- Configuring Atmosphere for Performance
- Understanding JavaScript functions
- Understanding AtmosphereResourceSession
- Improving Performance by using the PoolableBroadcasterFactory
- Using Atmosphere Jersey API
- Using Meteor API
- Using AtmosphereHandler API
- Using Socket.IO
- Using GWT
- Writing HTML5 Server-Sent Events
- Using STOMP protocol
- Streaming WebSocket messages
- Configuring Atmosphere's Classes Creation and Injection
- Using AtmosphereInterceptor to customize Atmosphere Framework
- Writing WebSocket sub protocol
- Configuring Atmosphere for the Cloud
- Injecting Atmosphere's Components in Jersey
- Sharing connection between Browser's windows and tabs
- Understanding AtmosphereResourceSession
- Manage installed services
- Server Side: javadoc API
- Server Side: atmosphere.xml and web.xml configuration
- Client Side: atmosphere.js API