         return clientConfiguration.log
     }
     
+    /// A closure to exectute on socket connection. Will be executed on background thread.
+    public var onConnect = {}
+    
+    /// A closure to exectute on socket disconnection. Will be executed on background thread.
+    public var onDisconnect = {}
+    
     /**
      Creates a new `GameClient`. Typically, only one of these should be created per run.
      

    
    public func websocketDidConnect(socket: WebSocket) {
        log.print("Connected to server", for: .connectAndDisconnect)
    }
    
    public func websocketDidDisconnect(socket: WebSocket, error: NSError?) {

            log.print(err.localizedDescription, for: .errors)
        }
        log.print("Connection closed - shutting down", for: .connectAndDisconnect)
        self.onDisconnect()
    }
    
    public func websocketDidReceiveMessage(socket: WebSocket, text: String) {
