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.Opened
or@
WebsocketEvent.Closed
. An application scoped CDI bean can@
Observes
them.For detailed usage instructions, see
@
Push
javadoc.- Since:
- 2.3
- See Also:
Push
,WebsocketEvent.Opened
,WebsocketEvent.Closed
, Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static interface
WebsocketEvent.Closed
Indicates that a<f:websocket>
has closed.static interface
WebsocketEvent.Opened
Indicates 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 boolean
equals(Object other)
String
getChannel()
Returns the<f:websocket channel>
.CloseReason.CloseCode
getCloseCode()
Returns the close code.<S extends Serializable>
SgetUser()
Returns the<f:websocket user>
, if any.int
hashCode()
String
toString()
-
-
-
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
- WhenS
is 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.
-
-