Interface XhrTransport
- All Superinterfaces:
InfoReceiver,Transport
- All Known Implementing Classes:
AbstractXhrTransport,JettyXhrTransport,RestTemplateXhrTransport,UndertowXhrTransport
public interface XhrTransport extends Transport, InfoReceiver
A SockJSTransportthat uses HTTP requests to simulate a WebSocket interaction. Theconnectmethod of the baseTransportinterface is used to receive messages from the server while theexecuteSendRequest(java.net.URI, org.springframework.http.HttpHeaders, org.springframework.web.socket.TextMessage)method here is used to send messages.- Since:
- 4.1
- Author:
- Rossen Stoyanchev
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description voidexecuteSendRequest(URI transportUrl, HttpHeaders headers, TextMessage message)Execute a request to send the message to the server.booleanisXhrStreamingDisabled()AnXhrTransportsupports both the "xhr_streaming" and "xhr" SockJS server transports.Methods inherited from interface org.springframework.web.socket.sockjs.client.InfoReceiver
executeInfoRequest
Methods inherited from interface org.springframework.web.socket.sockjs.client.Transport
connect, getTransportTypes
Method Detail
isXhrStreamingDisabled
boolean isXhrStreamingDisabled()
AnXhrTransportsupports both the "xhr_streaming" and "xhr" SockJS server transports. From a client perspective there is no implementation difference.By default an
XhrTransportwill be used with "xhr_streaming" first and then with "xhr", if the streaming fails to connect. In some cases it may be useful to suppress streaming so that only "xhr" is used.
executeSendRequest
void executeSendRequest(URI transportUrl, HttpHeaders headers, TextMessage message)
Execute a request to send the message to the server.Note that as of 4.2 this method accepts a
headersparameter.- Parameters:
transportUrl- the URL for sending messages.message- the message to send