private async Task ProcessConnectedClientAsync(WebSocket socket, string tableId, Guid userId) { await _messageExchanger.BroadcastMessageAsync(tableId, "userConnected", new { Users = _tables.Tables[tableId].Select(x => new { UserId = x.Key, Name = x.Value.Name }), UserId = userId, TableId = tableId }); if (_selections.Selections.ContainsKey(tableId)) { foreach (var item in _selections.Selections[tableId]) { await _messageExchanger.SendMessageAsync(socket, "cardSelection", item); } } }
public async Task Execute(string tableId, dynamic message) { var userId = new Guid(message.UserId); _tables.Tables[tableId][userId].Name = message.Value; await _messageExchanger.BroadcastMessageAsync(tableId, "userName", new { UserId = message.UserId, Name = message.Value }); }
public async Task Execute(string tableId, dynamic message) { if (!bool.TryParse(message.Value, out bool showCards)) { showCards = false; } await _messageExchanger.BroadcastMessageAsync(tableId, "revealCards", new { ShowCards = showCards }); }
public async Task Execute(string tableId, dynamic message) { await _messageExchanger.BroadcastMessageAsync(tableId, "cardSelection", new { Effort = message.Value, UserId = message.UserId }); _selections.StoreCardSelection(tableId, new CardSelection { Effort = message.Value, UserId = message.UserId, }); }
public async Task Execute(string tableId, dynamic message) { await _messageExchanger.BroadcastMessageAsync(tableId, "reset", new { ResetTable = message.Value }); _selections.ClearCardSelections(tableId); }