Class EventWebSocketAdapter
java.lang.Object
org.openhab.core.io.websocket.event.EventWebSocketAdapter
- All Implemented Interfaces:
EventSubscriber
,WebSocketAdapter
@NonNullByDefault
public class EventWebSocketAdapter
extends Object
implements EventSubscriber, WebSocketAdapter
The
EventWebSocketAdapter
allows subscription to oh events over WebSocket- Author:
- Jan N. Klug - Initial contribution
-
Field Summary
Fields inherited from interface org.openhab.core.events.EventSubscriber
ALL_EVENT_TYPES
-
Constructor Summary
ConstructorDescriptionEventWebSocketAdapter
(EventPublisher eventPublisher, ItemRegistry itemRegistry) -
Method Summary
Modifier and TypeMethodDescriptioncreateWebSocket
(org.eclipse.jetty.websocket.servlet.ServletUpgradeRequest servletUpgradeRequest, org.eclipse.jetty.websocket.servlet.ServletUpgradeResponse servletUpgradeResponse) Creates a websocket instance.getId()
The adapter id.Gets the event types to which the event subscriber is subscribed to.void
Callback method for receivingEvent
s from the openHAB event bus.void
registerListener
(EventWebSocket eventWebSocket) void
unregisterListener
(EventWebSocket eventWebSocket) Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.openhab.core.events.EventSubscriber
getEventFilter
-
Field Details
-
ADAPTER_ID
- See Also:
-
-
Constructor Details
-
EventWebSocketAdapter
-
-
Method Details
-
getSubscribedEventTypes
Description copied from interface:EventSubscriber
Gets the event types to which the event subscriber is subscribed to.- Specified by:
getSubscribedEventTypes
in interfaceEventSubscriber
- Returns:
- subscribed event types (not null)
-
receive
Description copied from interface:EventSubscriber
Callback method for receivingEvent
s 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 interfaceEventSubscriber
- Parameters:
event
- the received event (not null)
-
registerListener
-
unregisterListener
-
getId
Description copied from interface:WebSocketAdapter
The adapter id. In combination with the base pathCommonWebSocketServlet.SERVLET_PATH
defines the adapter path.- Specified by:
getId
in interfaceWebSocketAdapter
- Returns:
- 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 theorg.eclipse.jetty.websocket.api.annotations
or implementWebSocketListener
.- Specified by:
createWebSocket
in interfaceWebSocketAdapter
- Returns:
- a websocket instance.
-