Class EventWebSocketAdapter

All Implemented Interfaces:
EventSubscriber, WebSocketAdapter

@NonNullByDefault public class EventWebSocketAdapter extends Object implements EventSubscriber, WebSocketAdapter
The EventWebSocketAdapter allows subscription to oh events over WebSocket
Jan N. Klug - Initial contribution
  • Field Details

  • Constructor Details

  • Method Details

    • getSubscribedEventTypes

      public Set<String> getSubscribedEventTypes()
      Description copied from interface: EventSubscriber
      Gets the event types to which the event subscriber is subscribed to.
      Specified by:
      getSubscribedEventTypes in interface EventSubscriber
      subscribed event types (not null)
    • receive

      public void receive(Event event)
      Description copied from interface: EventSubscriber
      Callback method for receiving Events from the openHAB event bus. This method is called for every event where the event subscriber is subscribed to and the event filter applies.
      Specified by:
      receive in interface EventSubscriber
      event - the received event (not null)
    • registerListener

      public void registerListener(EventWebSocket eventWebSocket)
    • unregisterListener

      public void unregisterListener(EventWebSocket eventWebSocket)
    • getId

      public String getId()
      Description copied from interface: WebSocketAdapter
      The adapter id. In combination with the base path CommonWebSocketServlet.SERVLET_PATH defines the adapter path.
      Specified by:
      getId in interface WebSocketAdapter
      the adapter id.
    • createWebSocket

      public Object createWebSocket(org.eclipse.jetty.websocket.servlet.ServletUpgradeRequest servletUpgradeRequest, org.eclipse.jetty.websocket.servlet.ServletUpgradeResponse servletUpgradeResponse)
      Description copied from interface: WebSocketAdapter
      Creates a websocket instance. It should use the org.eclipse.jetty.websocket.api.annotations or implement WebSocketListener.
      Specified by:
      createWebSocket in interface WebSocketAdapter
      a websocket instance.