         print("[BRWebViewController disallowing navigation: \(navigationAction)")
         decisionHandler(.cancel)
     }
+    
+    // MARK: - socket delegate 
+    func sendTo(socket: BRWebSocket, data: [String: Any]) {
+        do {
+            let j = try JSONSerialization.data(withJSONObject: data, options: [])
+            if let s = String(data: j, encoding: .utf8) {
+                socket.request.queue.async {
+                    socket.send(s)
+                }
+            }
+        } catch let e {
+            print("LOCATION SOCKET FAILED ENCODE JSON: \(e)")
+        }
+    }
+    
+    func sendToAllSockets(data: [String: Any]) {
+        for (_, s) in sockets {
+            sendTo(socket: s, data: data)
+        }
+    }
+    
+    public func socketDidConnect(_ socket: BRWebSocket) {
+        print("WEBVIEW SOCKET CONNECT \(socket.id)")
+        sockets[socket.id] = socket
+        sendTo(socket: socket, data: webViewInfo)
+    }
+    
+    public func socketDidDisconnect(_ socket: BRWebSocket) {
+        print("WEBVIEW SOCKET DISCONNECT \(socket.id)")
+        sockets.removeValue(forKey: socket.id)
+    }
+    
+    public func socket(_ socket: BRWebSocket, didReceiveText text: String) {
+        print("WEBVIEW SOCKET RECV \(text)")
+        // this is unused here but just in case just echo received text back
+        socket.send(text)
+    }
 }

            return BRHTTPResponse(request: request, code: 204)
        }
        
        router.printDebug()
        
        // enable debug if it is turned on

    // signal to the presenter that the webview content successfully loaded
    fileprivate func webviewDidLoad() {
        didLoad = true
        sendToAllSockets(data: webViewInfo)
    }
    
    open func startServer() {
