Package jakarta.faces.event
Class WebsocketEvent
- java.lang.Object
-
- jakarta.faces.event.WebsocketEvent
-
- All Implemented Interfaces:
Serializable
public final class WebsocketEvent extends Object implements Serializable
This web socket event will be fired when a new
<f:websocket>has been@WebsocketEvent.Openedor@WebsocketEvent.Closed. An application scoped CDI bean can@Observesthem.For detailed usage instructions, see
@Pushjavadoc.- Since:
- 2.3
- See Also:
Push,WebsocketEvent.Opened,WebsocketEvent.Closed, Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static interfaceWebsocketEvent.ClosedIndicates that a<f:websocket>has closed.static interfaceWebsocketEvent.OpenedIndicates that a<f:websocket>has opened.
-
Constructor Summary
Constructors Constructor Description WebsocketEvent(String channel, Serializable user, CloseReason.CloseCode code)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanequals(Object other)StringgetChannel()Returns the<f:websocket channel>.CloseReason.CloseCodegetCloseCode()Returns the close code.<S extends Serializable>
SgetUser()Returns the<f:websocket user>, if any.inthashCode()StringtoString()
-
-
-
Constructor Detail
-
WebsocketEvent
public WebsocketEvent(String channel, Serializable user, CloseReason.CloseCode code)
-
-
Method Detail
-
getChannel
public String getChannel()
Returns the<f:websocket channel>.- Returns:
- The web socket channel name.
-
getUser
public <S extends Serializable> S getUser()
Returns the<f:websocket user>, if any.- Type Parameters:
S- The generic type of the user identifier.- Returns:
- The web socket user identifier, if any.
- Throws:
ClassCastException- WhenSis of wrong type.
-
getCloseCode
public CloseReason.CloseCode getCloseCode()
Returns the close code. If this returnsnull, then it wasWebsocketEvent.Opened. If this returns non-null, then it wasWebsocketEvent.Closed.- Returns:
- The close code.
-
-