Class SocketEvent

java.lang.Object
org.omnifaces.cdi.push.SocketEvent
All Implemented Interfaces:
Serializable

public final class SocketEvent extends Object

This web socket event will be fired by SocketSessionManager when a web socket has been @SocketEvent.Opened, @SocketEvent.Switched or @SocketEvent.Closed. An application scoped CDI bean can @Observes them.

For detailed usage instructions, see Socket javadoc.

Since:
2.3
Author:
Bauke Scholtz
See Also:
  • Method Details

    • getCloseCode

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

      public int hashCode()
    • equals

      public boolean equals(Object object)
    • toString

      public String toString()
    • getChannel

      public String getChannel()
      Returns the push channel name.
      Returns:
      The push channel name.
    • getUser

      public <S extends Serializable> S getUser()
      Returns the current user identifier, if any.
      Type Parameters:
      S - The generic type of the user identifier.
      Returns:
      The current user identifier, if any.
      Throws:
      ClassCastException - When S is of wrong type.
    • getPreviousUser

      public <S extends Serializable> S getPreviousUser()
      Returns the previous user identifier, if any.
      Type Parameters:
      S - The generic type of the user identifier.
      Returns:
      The previous user identifier, if any.
      Throws:
      ClassCastException - When S is of wrong type.