RESTCONF RFC8040 compliance: SSE support
[netconf.git] / restconf / restconf-nb-rfc8040 / src / main / java / org / opendaylight / restconf / nb / rfc8040 / streams / websockets / WebSocketSessionHandler.java
index 342637d374e1e36def059713caea3d77a2a1c58f..4ab507c561fd69132f512855a18ac9350bc14f46 100644 (file)
@@ -26,6 +26,7 @@ import org.eclipse.jetty.websocket.api.annotations.OnWebSocketClose;
 import org.eclipse.jetty.websocket.api.annotations.OnWebSocketConnect;
 import org.eclipse.jetty.websocket.api.annotations.OnWebSocketError;
 import org.eclipse.jetty.websocket.api.annotations.WebSocket;
+import org.opendaylight.restconf.nb.rfc8040.streams.SessionHandlerInterface;
 import org.opendaylight.restconf.nb.rfc8040.streams.listeners.BaseListenerInterface;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -35,7 +36,7 @@ import org.slf4j.LoggerFactory;
  * to data-change-event or notification listener, and sending of data over established web-socket session.
  */
 @WebSocket
-public class WebSocketSessionHandler {
+public class WebSocketSessionHandler implements SessionHandlerInterface {
 
     private static final Logger LOG = LoggerFactory.getLogger(WebSocketSessionHandler.class);
     private static final byte[] PING_PAYLOAD = "ping".getBytes(Charset.defaultCharset());
@@ -227,4 +228,13 @@ public class WebSocketSessionHandler {
             return Optional.empty();
         }
     }
+
+    @Override
+    public synchronized boolean isConnected() {
+        if (session != null && session.isOpen()) {
+            return true;
+        } else {
+            return false;
+        }
+    }
 }
\ No newline at end of file