Clients.Caller.receiver(re)
response pass successfully but suddenly in catch, I get an error for "Using a Hub instance not created by the HubPipeline is unsupported". Now I can't understand that where reference is missing. Please help me solve this one.
I am using below code
public async Task GetAllMessages(int roomid, int fromuserId, int touserId, int index, int pageSize, int broadcastid = 0) { ResponseModel re = new ResponseModel(); try { var model = new MessageDetailModel { Index = index, PageSize = pageSize, FromUserId = fromuserId, ToUserId = touserId, ChatRoomId = roomid, BroadCastId = broadcastid }; MesaageModel totalmessages = new MesaageModel(); List<RecentMessage> messages = new List<RecentMessage>(); var usermessages = await _userService.GetAllMessages(model); messages.AddRange(usermessages); foreach (var message in messages) { model.BroadCastMessageId = model.BroadCastId == 0 ? 0 : message.BroadCastMessageId; model.ChatRoomMessageId = model.BroadCastId == 0 ? message.ChatRoomMessageId : 0; List<UserDetail> userofseenby = new List<UserDetail>(); var users = await _userService.GetMessageSeenBy(model); userofseenby.AddRange(users); message.SeenBy = userofseenby; } totalmessages.Messages = messages; totalmessages.UnseenMessageCount = await _userService.GetUnSeenCount(messages.FirstOrDefault().ChatRoomId, fromuserId); if (messages.FirstOrDefault().IsBroadCast == true) totalmessages.Users = (List<UserDetail>)await _userService.GetUsersByBroadCastId(messages.FirstOrDefault().BroadCastId); else if (messages.FirstOrDefault().IsGroup == true) totalmessages.Users = (List<UserDetail>)await _userService.GetUsersByChatRoomId((int)messages.FirstOrDefault().ChatRoomId); re.MsgCode = 0; re.MsgText = "Success"; re.MsgType = MessageType.Success; re.ActionCommand = "onAllMessagesReceived"; re.SingleObject = totalmessages; Clients.Caller.receiver(re); } catch (Exception ex) { re.ActionCommand = "onAllMessagesReceived"; re = ResponseHelper.ErrorResponse(re.ActionCommand, ex.ToString()); Clients.Caller.receiver(re); } }