/// <summary> /// The method to send response message to the client /// </summary> /// <param name="userIds">List of User's Id to send response message</param> /// <param name="responseData">The response data to send message</param> /// <param name="method">Method name to natify the client</param> public async Task SendNotificationAsync(IEnumerable <object> userIds, object responseData, string method) { var responseMessage = NotificationResponseModel.SendNotification(responseData, method).GenerateJson(_logger); foreach (var socketId in userIds) { await SendMessageAsync(WSManager.GetWebSocket(socketId), responseMessage : responseMessage, method : method, userId : socketId, logger : _logger); } }
/// <summary> /// The method to send response message to the client /// </summary> /// <param name="userId">User's Id to send response message</param> /// <param name="responseData">The response data to send message</param> /// <param name="method">Method name to natify the client</param> public async Task SendNotificationAsync(object userId, object responseData, string method) { var responseMessage = NotificationResponseModel.SendNotification(responseData, method).GenerateJson(_logger); await SendMessageAsync(WSManager.GetWebSocket(userId), responseMessage : responseMessage, method : method, userId : userId, logger : _logger); }
/// <summary> /// The method to send response message to the client /// </summary> /// <param name="socket">WebSocket to send response message</param> /// <param name="responseData">The response data to send message</param> /// <param name="method">Method name to natify the client</param> public static async Task SendNotificationAsync(System.Net.WebSockets.WebSocket socket, object responseData, string method, ILogger logger, object userId = null) { var responseMessage = NotificationResponseModel.SendNotification(responseData, method).GenerateJson(logger); await SendMessageAsync(socket, responseMessage : responseMessage, method : method, userId : userId, logger : logger); }