/// <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);
        }
        /// <summary>
        /// The main method to receive requested message from the client
        /// </summary>
        /// <param name="socket">WebSocket which receive message</param>
        /// <param name="receiveMessageData">Receive message data from user</param>
        public async Task ReceiveMessageAsync(System.Net.WebSockets.WebSocket socket, string receiveMessageData)
        {
            ResponseModel responseModel = null;
            string        requestId     = string.Empty;
            string        requestMethod = string.Empty;
            object        userId        = null;

            try
            {
                var requestModel = JsonConvert.DeserializeObject <NotificationResponseModel>(receiveMessageData);
                var userInfo     = WSManager.GetUserInfo(socket);
                userId = userInfo?.Id;
                if (WebSocketManager.LoggAllWSRequest)
                {
                    _logger.LogInformation($"User id: {userId}, Method: {requestModel.Method}, Request data: {receiveMessageData}");
                }
                requestId     = requestModel.Id;
                requestMethod = requestModel.Method;
                if (userInfo == null)
                {
                    responseModel = await ResponseModel.NoAccessAsync(errorId : 105);
                }
                else
                {
                    if (string.IsNullOrEmpty(requestId) || string.IsNullOrEmpty(requestMethod))
                    {
                        responseModel = await ResponseModel.NoAccessAsync(errorId : 102);
                    }
                    else
                    {
                        var methodLevels = requestMethod.Split('.');
                        if (methodLevels.Length == 2)
                        {
                            var controller = WSManager.Controllers.FirstOrDefault(c => c.Name == methodLevels.First());
                            if (controller != null)
                            {
                                var wsHubMethod = controller.Methods.FirstOrDefault(m => m.Name == requestModel.Method);
                                if (wsHubMethod != null)
                                {
                                    var      paramsLength = requestModel.Params?.Count ?? 0;
                                    object[] methodParams = null;
                                    if (paramsLength >= 0)
                                    {
                                        var parameters = new List <object>();
                                        foreach (var parameter in wsHubMethod.Parameters)
                                        {
                                            var value = requestModel.Params.ContainsKey(parameter.Name) ? requestModel.Params[parameter.Name].ConvertTo(parameter.ParameterType) : parameter.DefaultValue;
                                            parameters.Add(value);
                                        }
                                        methodParams = parameters.ToArray();
                                    }
                                    var callingClass = Activator.CreateInstance(controller.Controller, new object[] { this, userInfo, _logger });
                                    responseModel = await(Task <ResponseModel>) wsHubMethod.Method.Invoke(callingClass, methodParams);
                                }
                                else
                                {
                                    responseModel = await ResponseModel.ErrorRequestAsync($"{requestMethod} method's parameters is invalid", 106);
                                }
                            }
                            else
                            {
                                responseModel = await ResponseModel.ErrorRequestAsync($"{requestMethod} method of {methodLevels.First()} class is invalid", 104);
                            }
                        }
                        else
                        {
                            responseModel = await ResponseModel.ErrorRequestAsync("Websocket request will support only two levels methods", 103);
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                _logger.LogError(ex, "Websocket request is invalid");
                responseModel = await ResponseModel.ErrorRequestAsync("Websocket request is invalid", 101);
            }

            if (responseModel != null)
            {
                var response = new NotificationResponseModel()
                {
                    Id      = requestId,
                    Method  = requestMethod,
                    ErrorId = responseModel.ErrorId,
                    Error   = responseModel.Error,
                    Result  = responseModel.Result
                };
                await SendMessageAsync(socket, response.GenerateJson(_logger), logger : _logger, method : response.Method, userId : userId);
            }
        }