Handling general events

The Connection class will allow you to subscribe to multiple events. These events are the following:

signalRConnection.OnConnected += (con) => Debug.Log("Connected to the SignalR server!");
signalRConnection.OnClosed += (con) => Debug.Log("Connection Closed");
signalRConnection.OnError += (conn, err) => Debug.Log("Error: " + err);
signalRConnection.OnReconnecting += (con) => Debug.Log("Reconnecting");
signalRConnection.OnReconnecting += (con) => Debug.Log("Reconnected");
signalRConnection.OnStateChanged += (conn, oldState, newState) => Debug.Log(string.Format("State Changed {0} -> {1}", oldState, newState));
signalRConnection.OnNonHubMessage += (con, data) => Debug.Log("Message from server: " + data.ToString());
signalRConnection.RequestPreparator = (con, req, type) => req.Timeout = TimeSpan.FromSeconds(30);