                 self.subscriberType[request.rootKeyPath] = R.SerializedObject.self
                 self.subscribers[request.rootKeyPath] = completion
                 self.subscriptions[request.rootKeyPath] = message
-                self.webSocket.write(string: message, completion: nil)
+                self.webSocket?.write(string: message, completion: nil)
             }
         }
         catch let error {

            }
            
            self.webSocket = WebSocket(request: request)
            self.webSocket.delegate = self
            self.webSocket.connect()
        }
        catch {
            return nil

    }
    
    public func disconnect() {
        self.webSocket?.disconnect()
        self.subscriptions.removeAll()
        self.subscribers.removeAll()
    }
