Interface WebsocketContext<W extends WebsocketContext<?>>

All Known Subinterfaces:
AppWebsocketContext, DefaultWebsocketContext
All Known Implementing Classes:
AppWebsocketContextDefault, DefaultWebsocketContextDefault

public interface WebsocketContext<W extends WebsocketContext<?>>
The base interface for a WebSocket context. A WebSocket context is the object passed to a WebSocket controller when an event for a particular peer occured. For example when a message is sent from a peer, or if the peer closed the WebSocket connection.
  • Method Details

    • getEndpointId

      String getEndpointId()
      The id of the endpoint
    • getPeerId

      String getPeerId()
      The id of the peer.
    • sendMessageToCurrentPeer

      void sendMessageToCurrentPeer(String message)
      Sends a String message to the current peer. Same as WebsocketEndpointManager#sendMessage(getPeerId(), message)
    • sendMessageToCurrentPeer

      void sendMessageToCurrentPeer(byte[] message)
      Sends a byte array message to the current peer. Same as WebsocketEndpointManager#sendMessage(getPeerId(), message)
    • closeConnectionWithCurrentPeer

      void closeConnectionWithCurrentPeer()
      Closes the connection with the current peer. Same as WebsocketEndpointManager#closePeer(getPeerId())
    • json

      JsonManager json()
      Easy access to the JsonManager, Json related methods.
    • xml

      XmlManager xml()
      Easy access to the XmlManager, XML related methods.
    • templating

      TemplatingEngine templating()
      Easy access to the TemplatingEngine, templating related methods.
    • guice

      com.google.inject.Injector guice()
      Easy access to the Guice context.
    • get

      <T> T get(Class<T> clazz)
      Shortcut to get an instance from Guice. Will also cache the instance (as long as it is request scoped or a singleton).
    • get

      <T> T get(com.google.inject.Key<T> key)
      Shortcut to get an instance from Guice. Will also cache the instance (as long as it is request scoped or a singleton)
    • getLocaleToUse

      Locale getLocaleToUse()
      The best Locale to use, as resolved by the LocaleResolver during the initial HTTP request.
    • getTimeZoneToUse

      TimeZone getTimeZoneToUse()
      The best TimeZone to use, as resolved by the TimeZoneResolver.