SockJsSession.
| Modifier and Type | Class and Description |
|---|---|
| private class | |
| private static enum |
| Modifier and Type | Field and Description |
|---|---|
| private final Map | |
| private final SockJsServiceConfig | |
| public static final String | DISCONNECTED_CLIENT_LOG_CATEGORY
Log category to use for network failure after a client has gone away. |
| private static final DisconnectedClientHelper | |
| private final WebSocketHandler | |
| private volatile boolean | |
| private ScheduledFuture | |
| private AbstractSockJsSession. | |
| private final String | |
| protected final Log | |
| protected final Object | |
| private volatile AbstractSockJsSession. | |
| private final long | |
| private volatile long |
| Access | Constructor and Description |
|---|---|
| public | AbstractSockJsSession(String
the session ID id, SockJsServiceConfig the SockJS service configuration options config, WebSocketHandler the recipient of SockJS messages handler, Map<String, Object> the attributes from the HTTP handshake to associate with the WebSocket
session; the provided attributes are copied, the original map is not used. attributes)Create a new instance. |
| Modifier and Type | Method and Description |
|---|---|
| protected void | |
| public final void | close()
Implements org. Performs cleanup and notify the |
| public final void | close(CloseStatus status)
Implements org. Performs cleanup and notify the |
| public final void | |
| public void | |
| public void | |
| public void | |
| public void | disableHeartbeat()
Implements org. Disable the SockJS heartbeat, presumably because a higher-level protocol has heartbeats enabled for the session already. |
| protected abstract void | disconnect(CloseStatus status)
Actually close the underlying WebSocket session or in the case of HTTP transports complete the underlying request. |
| public Map | getAttributes()
Implements org. Return the map with attributes associated with the WebSocket session. |
| public String | getId()
Implements org. Return a unique session identifier. |
| protected SockJsMessageCodec | |
| public SockJsServiceConfig | |
| public long | getTimeSinceLastActive()
Implements org. Return the time (in ms) since the session was last active, or otherwise if the session is new, then the time since the session was created. |
| private static List | |
| public abstract boolean | isActive()
Polling and Streaming sessions periodically close the current HTTP request and wait for the next request to come through. |
| public boolean | |
| public boolean | |
| public boolean | isOpen()
Implements org. Whether the underlying connection is open. |
| private void | |
| private void | |
| protected void | |
| protected void | |
| public final void | sendMessage(WebSocketMessage<?> message)
Implements org. Send a WebSocket message: either |
| protected abstract void | |
| public String | |
| public void | tryCloseWithSockJsTransportError(Throwable error, CloseStatus closeStatus)
Close due to error arising from SockJS transport handling. |
| protected void | |
| protected void | writeFrame(SockJsFrame frame)
For internal use within a TransportHandler and the (TransportHandler-specific) session class. |
| protected abstract void |
| attributes | back to summary |
|---|---|
| private final Map<String, Object> attributes | |
| config | back to summary |
|---|---|
| private final SockJsServiceConfig config | |
| DISCONNECTED_CLIENT_LOG_CATEGORY | back to summary |
|---|---|
| public static final String DISCONNECTED_CLIENT_LOG_CATEGORY Log category to use for network failure after a client has gone away.
| |
| disconnectedClientHelper | back to summary |
|---|---|
| private static final DisconnectedClientHelper disconnectedClientHelper | |
| handler | back to summary |
|---|---|
| private final WebSocketHandler handler | |
| heartbeatDisabled | back to summary |
|---|---|
| private volatile boolean heartbeatDisabled | |
| heartbeatFuture | back to summary |
|---|---|
| private ScheduledFuture<?> heartbeatFuture
| |
| heartbeatTask | back to summary |
|---|---|
| private AbstractSockJsSession. | |
| id | back to summary |
|---|---|
| private final String id | |
| logger | back to summary |
|---|---|
| protected final Log logger | |
| responseLock | back to summary |
|---|---|
| protected final Object responseLock | |
| state | back to summary |
|---|---|
| private volatile AbstractSockJsSession. | |
| timeCreated | back to summary |
|---|---|
| private final long timeCreated | |
| timeLastActive | back to summary |
|---|---|
| private volatile long timeLastActive | |
| AbstractSockJsSession | back to summary |
|---|---|
| public AbstractSockJsSession(String id, SockJsServiceConfig config, WebSocketHandler handler, Map<String, Object> attributes) Create a new instance.
| |
| cancelHeartbeat | back to summary |
|---|---|
| protected void cancelHeartbeat() | |
| close | back to summary |
|---|---|
| public final void close() throws IOException Implements org. Performs cleanup and notify the
| |
| close | back to summary |
|---|---|
| public final void close(CloseStatus status) throws IOException Implements org. Performs cleanup and notify the
| |
| delegateConnectionClosed | back to summary |
|---|---|
| public final void delegateConnectionClosed(CloseStatus status) throws Exception Invoked when the underlying connection is closed. | |
| delegateConnectionEstablished | back to summary |
|---|---|
| public void delegateConnectionEstablished() throws Exception | |
| delegateError | back to summary |
|---|---|
| public void delegateError(Throwable ex) throws Exception | |
| delegateMessages | back to summary |
|---|---|
| public void delegateMessages(String... messages) throws SockJsMessageDeliveryException | |
| disableHeartbeat | back to summary |
|---|---|
| public void disableHeartbeat() Implements org. Doc from org. Disable the SockJS heartbeat, presumably because a higher-level protocol has heartbeats enabled for the session already. It is not recommended to disable this otherwise, as it helps proxies to know the connection is not hanging.
| |
| disconnect | back to summary |
|---|---|
| protected abstract void disconnect(CloseStatus status) throws IOException Actually close the underlying WebSocket session or in the case of HTTP transports complete the underlying request. | |
| getAttributes | back to summary |
|---|---|
| public Map Implements org. Doc from org. Return the map with attributes associated with the WebSocket session. On the server side the map can be populated initially through a
| |
| getId | back to summary |
|---|---|
| public String getId() Implements org. Doc from org. Return a unique session identifier.
| |
| getMessageCodec | back to summary |
|---|---|
| protected SockJsMessageCodec getMessageCodec() | |
| getSockJsServiceConfig | back to summary |
|---|---|
| public SockJsServiceConfig getSockJsServiceConfig() | |
| getTimeSinceLastActive | back to summary |
|---|---|
| public long getTimeSinceLastActive() Implements org. Doc from org. Return the time (in ms) since the session was last active, or otherwise if the session is new, then the time since the session was created.
| |
| getUndelivered | back to summary |
|---|---|
| private static List | |
| isActive | back to summary |
|---|---|
| public abstract boolean isActive() Polling and Streaming sessions periodically close the current HTTP request and wait for the next request to come through. During this "downtime" the session is still open but inactive and unable to send messages and therefore has to buffer them temporarily. A WebSocket session by contrast is stateful and remain active until closed. | |
| isClosed | back to summary |
|---|---|
| public boolean isClosed() | |
| isNew | back to summary |
|---|---|
| public boolean isNew() | |
| isOpen | back to summary |
|---|---|
| public boolean isOpen() Implements org. Doc from org. Whether the underlying connection is open.
| |
| logUndeliveredMessages | back to summary |
|---|---|
| private void logUndeliveredMessages(int index, String[] messages) | |
| logWriteFrameFailure | back to summary |
|---|---|
| private void logWriteFrameFailure(Throwable ex) | |
| scheduleHeartbeat | back to summary |
|---|---|
| protected void scheduleHeartbeat() | |
| sendHeartbeat | back to summary |
|---|---|
| protected void sendHeartbeat() throws SockJsTransportFailureException | |
| sendMessage | back to summary |
|---|---|
| public final void sendMessage(WebSocketMessage<?> message) throws IOException Implements org. Doc from org. Send a WebSocket message: either Note The underlying standard WebSocket session (JSR-356) does
not allow concurrent sending. Therefore, sending must be synchronized. To ensure
that, one option is to wrap the
| |
| sendMessageInternal | back to summary |
|---|---|
| protected abstract void sendMessageInternal(String message) throws IOException | |
| toString | back to summary |
|---|---|
| public String toString() Overrides java. Doc from java. Returns a string representation of the object.
Satisfying this method's contract implies a non- | |
| tryCloseWithSockJsTransportError | back to summary |
|---|---|
| public void tryCloseWithSockJsTransportError(Throwable error, CloseStatus closeStatus) Close due to error arising from SockJS transport handling. | |
| updateLastActiveTime | back to summary |
|---|---|
| protected void updateLastActiveTime() Should be invoked whenever the session becomes inactive. | |
| writeFrame | back to summary |
|---|---|
| protected void writeFrame(SockJsFrame frame) throws SockJsTransportFailureException For internal use within a TransportHandler and the (TransportHandler-specific) session class. | |
| writeFrameInternal | back to summary |
|---|---|
| protected abstract void writeFrameInternal(SockJsFrame frame) throws IOException | |
| Modifier and Type | Field and Description |
|---|---|
| private boolean |
| Access | Constructor and Description |
|---|---|
| private |
| Modifier and Type | Method and Description |
|---|---|
| pack-priv void | |
| public void |
| expired | back to summary |
|---|---|
| private boolean expired | |
| HeartbeatTask | back to summary |
|---|---|
| private HeartbeatTask() | |
| cancel | back to summary |
|---|---|
| pack-priv void cancel() | |
| run | back to summary |
|---|---|
| public void run() Implements java. Doc from java. Runs this operation.
| |
| Modifier and Type | Field and Description |
|---|---|
| public static final AbstractSockJsSession. | |
| public static final AbstractSockJsSession. | |
| public static final AbstractSockJsSession. |
| Access | Constructor and Description |
|---|---|
| private |
| Modifier and Type | Method and Description |
|---|---|
| public static AbstractSockJsSession. | |
| public static AbstractSockJsSession. |
| CLOSED | back to summary |
|---|---|
| public static final AbstractSockJsSession. | |
| NEW | back to summary |
|---|---|
| public static final AbstractSockJsSession. | |
| OPEN | back to summary |
|---|---|
| public static final AbstractSockJsSession. | |
| State | back to summary |
|---|---|
| private State() | |
| valueOf | back to summary |
|---|---|
| public static AbstractSockJsSession. | |
| values | back to summary |
|---|---|
| public static AbstractSockJsSession. | |