Top Description Methods
org.springframework.web.socket.sockjs.client

public Interface XhrTransport

extends Transport, InfoReceiver
Known Direct Implementers
org.springframework.web.socket.sockjs.client.AbstractXhrTransport
Imports
java.net.URI, org.springframework.http.HttpHeaders, org.springframework.web.socket.TextMessage

A SockJS Transport that uses HTTP requests to simulate a WebSocket interaction. The connect method of the base Transport interface is used to receive messages from the server while the executeSendRequest method here is used to send messages.
Author
Rossen Stoyanchev
Since
4.1

Method Summary

Modifier and TypeMethod and Description
public void
executeSendRequest(URI
the URL for sending messages.
transportUrl
,
HttpHeaders headers, TextMessage
the message to send
message
)

Execute a request to send the message to the server.

public boolean
isXhrStreamingDisabled()

An XhrTransport supports both the "xhr_streaming" and "xhr" SockJS server transports.

Inherited from org.springframework.web.socket.sockjs.client.InfoReceiver:
executeInfoRequest
Inherited from org.springframework.web.socket.sockjs.client.Transport:
connectconnectAsyncgetTransportTypes

Method Detail

executeSendRequestback to summary
public 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 headers parameter.

Parameters
transportUrl:URI

the URL for sending messages.

message:TextMessage

the message to send

isXhrStreamingDisabledback to summary
public boolean isXhrStreamingDisabled()

An XhrTransport supports both the "xhr_streaming" and "xhr" SockJS server transports. From a client perspective there is no implementation difference.

By default an XhrTransport will 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.