public void Register(string roomId, string clientId) { CheckIfCalledOnValidThread(); _roomId = roomId; _clientId = clientId; if (State != WebSocketConnectionState.Connected) { Logger.Debug(TAG, $"WebSocket register() in state {State}"); return; } var registerMessage = new { cmd = "register", roomid = roomId, clientid = clientId }; var json = JsonConvert.SerializeObject(registerMessage); Logger.Debug(TAG, $"C->WSS: {json}"); WebSocketConnection.Send(json); State = WebSocketConnectionState.Registered; foreach (var sendMessage in WsSendQueue) { Send(sendMessage); } WsSendQueue.Clear(); }
public void Register(string message) { CheckIfCalledOnValidThread(); _registerMessage = message; if (State != WebSocketConnectionState.Connected) { Logger.Warning(TAG, $"WebSocket register() in state {State}"); return; } Logger.Debug(TAG, $"C->WSS: {message}"); Send(message); State = WebSocketConnectionState.Registered; foreach (var sendMessage in WsSendQueue) { Send(sendMessage); } WsSendQueue.Clear(); _registerMessage = null; }