org.springframework.web.socket.messaging

## Class SessionDisconnectEvent

- java.lang.Object
- - java.util.EventObject
  - - org.springframework.context.ApplicationEvent
    - - org.springframework.web.socket.messaging.AbstractSubProtocolEvent
      - - org.springframework.web.socket.messaging.SessionDisconnectEvent

All Implemented Interfaces:
  Serializable

    public class SessionDisconnectEvent
    extends AbstractSubProtocolEvent

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.

Since:
  4.0.3
Author:
  Rossen Stoyanchev
See Also:
  Serialized Form

### Field Summary

### Fields inherited from class java.util.EventObject

`source`

### Constructor Summary

Constructors
Constructor and Description
`SessionDisconnectEvent(Object source, org.springframework.messaging.Message<byte[]> message, String sessionId, CloseStatus closeStatus)` Create a new SessionDisconnectEvent.
`SessionDisconnectEvent(Object source, org.springframework.messaging.Message<byte[]> message, String sessionId, CloseStatus closeStatus, Principal user)` Create a new SessionDisconnectEvent.

### Method Summary

All Methods Instance Methods Concrete Methods
`CloseStatus` `getCloseStatus()` Return the status with which the session was closed.
`String` `getSessionId()` Return the session id.
`String` `toString()`

### Methods inherited from class org.springframework.web.socket.messaging.AbstractSubProtocolEvent

`getMessage, getUser`

### Methods inherited from class org.springframework.context.ApplicationEvent

`getTimestamp`

### Methods inherited from class java.util.EventObject

`getSource`

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

### Constructor Detail

#### SessionDisconnectEvent

    public SessionDisconnectEvent(Object source,
                                  org.springframework.messaging.Message<byte[]> message,
                                  String sessionId,
                                  CloseStatus closeStatus)

Create a new SessionDisconnectEvent.

Parameters:
  `source` - the component that published the event (never `null`)
  `message` - the message (never `null`)
  `sessionId` - the disconnect message
  `closeStatus` - the status object

#### SessionDisconnectEvent

    public SessionDisconnectEvent(Object source,
                                  org.springframework.messaging.Message<byte[]> message,
                                  String sessionId,
                                  CloseStatus closeStatus,
                                  @Nullable
                                  Principal user)

Create a new SessionDisconnectEvent.

Parameters:
  `source` - the component that published the event (never `null`)
  `message` - the message (never `null`)
  `sessionId` - the disconnect message
  `closeStatus` - the status object
  `user` - the current session user

### Method Detail

#### getSessionId

    public String getSessionId()

Return the session id.

#### getCloseStatus

    public CloseStatus getCloseStatus()

Return the status with which the session was closed.

#### toString

    public String toString()

Overrides:
  `toString` in class `AbstractSubProtocolEvent`