public override async Task OnConnectedAsync() { var httpContext = Context.GetHttpContext(); var otherUser = httpContext.Request.Query["user"].ToString(); var groupName = GetGroupName(Context.User.GetUsername(), otherUser); await Groups.AddToGroupAsync(Context.ConnectionId, groupName); var messages = await _messageLogic.GetMessageThread(Context.User.GetUsername(), otherUser); await Clients.Group(groupName).SendAsync("ReceiveMessageThread", messages); await AddToGroup(groupName); }
public async Task <IActionResult> GetMessageThread(string username) { var loggedIn = User.GetUsername(); return(Ok(await _messageLogic.GetMessageThread(loggedIn, username))); }