Package org.omnifaces.cdi.push
Class SocketEvent
- java.lang.Object
-
- org.omnifaces.cdi.push.SocketEvent
-
- All Implemented Interfaces:
Serializable
public final class SocketEvent extends Object implements Serializable
This web socket event will be fired by
SocketSessionManager
when a socket has been@
SocketEvent.Opened
,@
SocketEvent.Switched
or@
SocketEvent.Closed
. An application scoped CDI bean can@
Observes
them.For detailed usage instructions, see
Socket
javadoc.- Since:
- 2.3
- Author:
- Bauke Scholtz
- See Also:
Socket
, Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static interface
SocketEvent.Closed
Indicates that a socket has closed.static interface
SocketEvent.Opened
Indicates that a socket has opened.static interface
SocketEvent.Switched
Indicates that a socket user was switched.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
equals(Object object)
String
getChannel()
Returns the<o:socket channel>
.CloseReason.CloseCode
getCloseCode()
Returns the close code.<S extends Serializable>
SgetPreviousUser()
Returns the previous<o:socket user>
, if any.<S extends Serializable>
SgetUser()
Returns the current<o:socket user>
, if any.int
hashCode()
String
toString()
-
-
-
Method Detail
-
getChannel
public String getChannel()
Returns the<o:socket channel>
.- Returns:
- The web socket channel name.
-
getUser
public <S extends Serializable> S getUser()
Returns the current<o:socket user>
, if any.- Type Parameters:
S
- The generic type of the user identifier.- Returns:
- The current web socket user identifier, if any.
- Throws:
ClassCastException
- WhenS
is of wrong type.
-
getPreviousUser
public <S extends Serializable> S getPreviousUser()
Returns the previous<o:socket user>
, if any.- Type Parameters:
S
- The generic type of the user identifier.- Returns:
- The previous web socket user identifier, if any.
- Throws:
ClassCastException
- WhenS
is of wrong type.- Since:
- 3.2
-
getCloseCode
public CloseReason.CloseCode getCloseCode()
Returns the close code. If this returnsnull
, then it wasSocketEvent.Opened
. If this returns non-null
, then it wasSocketEvent.Closed
.- Returns:
- The close code.
-
-