- 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
SocketSessionManagerwhen a socket has been@SocketEvent.Opened,@SocketEvent.Switchedor@SocketEvent.Closed. An application scoped CDI bean can@Observesthem.For detailed usage instructions, see
Socketjavadoc.- Since:
- 2.3
- Author:
- Bauke Scholtz
- See Also:
Socket, Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static interfaceSocketEvent.ClosedIndicates that a socket has closed.static interfaceSocketEvent.OpenedIndicates that a socket has opened.static interfaceSocketEvent.SwitchedIndicates that a socket user was switched.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanequals(Object object)StringgetChannel()Returns the<o:socket channel>.CloseReason.CloseCodegetCloseCode()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.inthashCode()StringtoString()
-
-
-
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- WhenSis 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- WhenSis 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.
-
-