Interface Transport

All Known Subinterfaces:
All Known Implementing Classes:
AbstractHttpClientTransport, AbstractHttpTransport, AbstractServerTransport, AbstractStreamHttpTransport, AbstractTransport, AbstractWebSocketTransport, AbstractWebSocketTransport, AsyncJSONTransport, ClientTransport, HttpClientTransport, JettyHttpClientTransport, JettyWebSocketTransport, JettyWebSocketTransport, JSONPTransport, JSONTransport, OkHttpClientTransport, OkHttpWebSocketTransport, WebSocketTransport, WebSocketTransport

public interface Transport

A transport abstract the details of the protocol used to send Bayeux messages over the network, for example using HTTP or using WebSocket.

Transports have well known names and both a Bayeux client and a Bayeux server can negotiate the transport they want to use by exchanging the list of supported transport names.

Transports can be configured using options. The transport implementation provides a set of option names that it uses to configure itself and an option prefix that allows specific tuning of the configuration. Option prefixes may be composed of segments separated by the "." character.

For example, imagine to configure the transports for normal long polling, for JSONP long polling and for WebSocket. All provide a common option name called "timeout" and the JSONP long polling transport provides also a specific option name called "callback". The normal long polling transport has prefix "long-polling.json", the JSONP long polling transport has prefix "long-polling.jsonp" and the WebSocket long polling transport has prefix "ws". The first two prefixes have 2 segments.

The configurator will asks the transports the set of option names, obtaining ["timeout", "callback"]; then will ask each transport its prefix, obtaining ["long-polling.json", "long-polling.jsonp"]. The configurator can now look in the configuration (for example a properties file or servlet init parameters) for entries that combine the option names and option prefix segments, such as:

  • "timeout": specifies the timeout for all transports
  • "long-polling.timeout": specifies the timeout for both normal long polling transport and JSONP long polling transport, but not for the WebSocket transport
  • "long-polling.jsonp.timeout": specifies the timeout for JSONP long polling transport overriding more generic entries
  • "ws.timeout": specifies the timeout for WebSocket transport overriding more generic entries
  • "long-polling.jsonp.callback": specifies the "callback" parameter for the JSONP long polling transport.