2 * Copyright (c) 2010-2023 Contributors to the openHAB project
4 * See the NOTICE file(s) distributed with this work for additional
7 * This program and the accompanying materials are made available under the
8 * terms of the Eclipse Public License 2.0 which is available at
9 * http://www.eclipse.org/legal/epl-2.0
11 * SPDX-License-Identifier: EPL-2.0
13 package org.openhab.binding.webthing.internal.client;
15 import java.util.function.BiConsumer;
17 import org.eclipse.jdt.annotation.NonNullByDefault;
20 * The WebsocketConnection represents an open WebSocket connection on the Web Thing. It provides a realtime mechanism
21 * to be notified of events as soon as they happen. Refer https://iot.mozilla.org/wot/#web-thing-websocket-api
23 * @author Gregor Roth - Initial contribution
26 interface WebSocketConnection {
29 * Makes a request for Property value change notifications
31 * @param propertyName the property to be observed
32 * @param listener the listener to call on changes
34 void observeProperty(String propertyName, BiConsumer<String, Object> listener);
37 * closes the WebSocket connection
42 * @return true, if connection is alive