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:
  • Constructor Details

    • WebsocketEvent

      public WebsocketEvent(String channel, Serializable user, jakarta.websocket.CloseReason.CloseCode code)
  • Method Details

    • 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 - When S is of wrong type.
    • getCloseCode

      public jakarta.websocket.CloseReason.CloseCode getCloseCode()
      Returns the close code. If this returns null, then it was WebsocketEvent.Opened. If this returns non-null, then it was WebsocketEvent.Closed.
      Returns:
      The close code.
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • equals

      public boolean equals(Object other)
      Overrides:
      equals in class Object
    • toString

      public String toString()
      Overrides:
      toString in class Object