Top Description Fields Constructors Methods
org.springframework.web.socket.messaging

public Class SessionDisconnectEvent

extends AbstractSubProtocolEvent
Class Inheritance
Annotations
@SuppressWarnings:serial
Imports
java.security.Principal, org.springframework.lang.Nullable, org.springframework.messaging.Message, org.springframework.util.Assert, org.springframework.web.socket.CloseStatus

Event raised when the session of a WebSocket client using a Simple Messaging Protocol (e.g. STOMP) as the WebSocket sub-protocol is closed.

Note that this event may be raised more than once for a single session and therefore event consumers should be idempotent and ignore a duplicate event.

Author
Rossen Stoyanchev
Since
4.0.3

Field Summary

Modifier and TypeField and Description
private final String
private final CloseStatus

Constructor Summary

AccessConstructor and Description
public
SessionDisconnectEvent(Object
the component that published the event (never null)
source
,
Message<byte[]>
the message (never null)
message
,
String
the disconnect message
sessionId
,
CloseStatus
the status object
closeStatus
)

Create a new SessionDisconnectEvent.

public
SessionDisconnectEvent(Object
the component that published the event (never null)
source
,
Message<byte[]>
the message (never null)
message
,
String
the disconnect message
sessionId
,
CloseStatus
the status object
closeStatus
,
Principal
the current session user
user
)

Create a new SessionDisconnectEvent.

Method Summary

Modifier and TypeMethod and Description
public CloseStatus
getCloseStatus()

Return the status with which the session was closed.

public String
getSessionId()

Return the session id.

public String
toString()

Overrides org.springframework.web.socket.messaging.AbstractSubProtocolEvent.toString.

Returns a String representation of this EventObject.

Inherited from org.springframework.web.socket.messaging.AbstractSubProtocolEvent:
getMessagegetUser

Field Detail

sessionIdback to summary
private final String sessionId
statusback to summary
private final CloseStatus status

Constructor Detail

SessionDisconnectEventback to summary
public SessionDisconnectEvent(Object source, Message<byte[]> message, String sessionId, CloseStatus closeStatus)

Create a new SessionDisconnectEvent.

Parameters
source:Object

the component that published the event (never null)

message:Message<byte[]>

the message (never null)

sessionId:String

the disconnect message

closeStatus:CloseStatus

the status object

SessionDisconnectEventback to summary
public SessionDisconnectEvent(Object source, Message<byte[]> message, String sessionId, CloseStatus closeStatus, Principal user)

Create a new SessionDisconnectEvent.

Parameters
source:Object

the component that published the event (never null)

message:Message<byte[]>

the message (never null)

sessionId:String

the disconnect message

closeStatus:CloseStatus

the status object

user:Principal

the current session user

Method Detail

getCloseStatusback to summary
public CloseStatus getCloseStatus()

Return the status with which the session was closed.

getSessionIdback to summary
public String getSessionId()

Return the session id.

toStringback to summary
public String toString()

Overrides org.springframework.web.socket.messaging.AbstractSubProtocolEvent.toString.

Doc from java.util.EventObject.toString.

Returns a String representation of this EventObject.

Returns:String

a String representation of this EventObject

Annotations
@Override