public async void Join([FromBody] User userJoining, [FromQuery] string socketId) { Console.WriteLine("UserController : Join"); if (userJoining.userId == Guid.Empty) { userJoining.userId = Guid.NewGuid(); } var mess = _notificationsMessageHandler.GenerateMessageFromPayload(userJoining, MessageType.JoinRequested); await _notificationsMessageHandler.SendMessageAsync(socketId, mess); _userHandler.Add(userJoining, socketId); mess = _notificationsMessageHandler.GenerateMessageFromPayload(_chatHandler.GetCacheMessages(), MessageType.MessageHistory); await _notificationsMessageHandler.SendMessageAsync(socketId, mess); mess = _notificationsMessageHandler.GenerateMessageFromPayload(_userHandler.GetUsers(), MessageType.UsersRequested); await _notificationsMessageHandler.SendMessageAsync(socketId, mess); mess = _notificationsMessageHandler.GenerateMessageFromPayload(userJoining, MessageType.UserJoined); await _notificationsMessageHandler.SendMessageToAllAsync(mess); }
public async void GetList(string socketId) { Console.WriteLine("MessageController : GetList"); var mess = _notificationsMessageHandler.GenerateMessageFromPayload(_chatHandler.GetCacheMessages(), MessageType.MessageHistory); await _notificationsMessageHandler.SendMessageAsync(socketId, mess); }