public void SendMessageToUserId(string userId, string messgae) { Message msg = new Message(); string connectionId = redisService.GetRedisValueSelectDb(userId, dbNumber); try { msg.code = 200; msg.desc = "SIGNALR_SUCCESS"; msg.content = messgae; string signalRContent = JsonHelper.AsJson(msg).ToString(); Clients.Client(connectionId).SendAsync("ReceiveMessageToUserId", signalRContent); } catch (Exception ex) { msg.code = 500; msg.desc = "SIGNALR_ERROR"; msg.content = ex.ToString(); string signalRContent = JsonHelper.AsJson(msg).ToString(); Clients.Client(connectionId).SendAsync("ReceiveMessageToUserId", signalRContent); } }
public async Task <string> ResponseAsJson(HttpResponseMessage httpResponse) { var body = await httpResponse?.Content?.ReadAsStringAsync(); return(JsonHelper.AsJson(body)); }