APE_JSF Transports

Louis Charette edited this page Apr 19, 2014 · 1 revision

APE supports different transport methods:

  • Long Polling: default transport method
  • JSONP: for cross domain push
  • XHRStreaming: for better performance and low latency
  • Websockets: for the best performance Don't forget to clear your cookies if you change the transport method!

Long Polling

With long polling, the client requests information from the server in a similar way to a normal poll. However, if the server does not have any information available for the client, instead of sending an empty response, the server holds the request and waits for some information to be available. Once the information becomes available (or after a suitable timeout), a complete response is sent to the client. The client then immediately re-request information from the server.

JSONP

Note: this text is taken from wikipedia This transport method allow APE to work cross domain. For example your APE Server run on http://ape.yourdomain.com but you also want it to be accessible any other domain. This can be done using JSONP. To activate JSONP edit your APE JSF config file and add :

APE.Config.transport = 2;  // 2 is JSONP

XHRStreaming

This transport method is similar to long polling, but instead of closing connection when new data arrives, the server keeps the connection open. This only works in browsers based on Gecko or Webkit (e.g. Safari, Chrome, Firefox). To activate XHRStreaming, edit your APE JSF config file and add:

APE.Config.transport = 1;  // 1 is XHRStreaming

If the browser doesn't support XHRStreaming, APE JSF falls back to long polling.

Websocket

Websocket is the most efficient transport available. However, it is not supported by older version of Internet Explorer. If the browser does not support Websocket, the APE client will fall back to XHRStreaming or Longpolling automatically. To activate websocket, edit your APE JSF config file and add:

APE.Config.transport = 6;  // 6 is Websocket