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.orbitbhyve.internal.net;
15 import org.eclipse.jdt.annotation.NonNullByDefault;
16 import org.eclipse.jdt.annotation.Nullable;
17 import org.eclipse.jetty.websocket.api.WebSocketAdapter;
18 import org.openhab.binding.orbitbhyve.internal.handler.OrbitBhyveBridgeHandler;
19 import org.slf4j.Logger;
20 import org.slf4j.LoggerFactory;
23 * The {@link OrbitBhyveSocket} class defines websocket used for connection with
24 * the Orbit B-Hyve cloud.
26 * @author Ondrej Pecta - Initial contribution
29 public class OrbitBhyveSocket extends WebSocketAdapter {
30 private final Logger logger = LoggerFactory.getLogger(OrbitBhyveSocket.class);
31 private OrbitBhyveBridgeHandler handler;
33 public OrbitBhyveSocket(OrbitBhyveBridgeHandler handler) {
34 this.handler = handler;
38 public void onWebSocketText(@Nullable String message) {
39 super.onWebSocketText(message);
40 if (message != null) {
41 logger.trace("Got message: {}", message);
42 handler.processStatusResponse(message);