Package javax.faces.event
Class WebsocketEvent
- java.lang.Object
-
- javax.faces.event.WebsocketEvent
-
- All Implemented Interfaces:
java.io.Serializable
public final class WebsocketEvent extends java.lang.Object implements java.io.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(java.lang.String channel, java.io.Serializable user, CloseReason.CloseCode code)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
equals(java.lang.Object other)
java.lang.String
getChannel()
Returns the<f:websocket channel>
.CloseReason.CloseCode
getCloseCode()
Returns the close code.<S extends java.io.Serializable>
SgetUser()
Returns the<f:websocket user>
, if any.int
hashCode()
java.lang.String
toString()
-
-
-
Constructor Detail
-
WebsocketEvent
public WebsocketEvent(java.lang.String channel, java.io.Serializable user, CloseReason.CloseCode code)
-
-
Method Detail
-
getChannel
public java.lang.String getChannel()
Returns the<f:websocket channel>
.- Returns:
- The web socket channel name.
-
getUser
public <S extends java.io.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:
java.lang.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.
-
hashCode
public int hashCode()
- Overrides:
hashCode
in classjava.lang.Object
-
equals
public boolean equals(java.lang.Object other)
- Overrides:
equals
in classjava.lang.Object
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
-