Skip to content

Navigation Menu

Sign in
Sign up

Understanding the Atmosphere Protocol

jfarcand edited this page Jul 9, 2012 · 13 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 are planning to write an Atmosphere enabled client, the mandatory keys/values are:

  • X-Atmosphere-Framework = version The lowest Atmosphere's version supported
  • X-Cache-Date = This header is used to retrieve lost events on the server side. Lost events happens when the browser reload the page, when the connection gets closed or any I/O related issue. The client always first set that value to 0, and after always use the value send back by the server, as a response's header. If the server's value cannot be retrieved, the value should be set to 0 and the server will figure out which events to send back.
  • 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.
  • _timeStamp a unique value starting with _ . This is required to prevent browsers from caching request.

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/.
Cookie: nikio.guid=890066de-f3ad-4e33-a96a-a80c6fc1d4a7.

Clone this wiki locally

AltStyle によって変換されたページ (->オリジナル) /