Example #1
0
        public override async Task OnConnectedAsync()
        {
            string        sessionId     = Context.GetHttpContext().Request.Query["sessionid"];
            EditorSession editorSession = await _dbContext.Sessions.Include(x => x.Teacher).SingleOrDefaultAsync(x => x.Id == Guid.Parse(sessionId)); // SingleOrDefault(x => x.Id == Guid.Parse(sessionId));

            if (Context.User.Identity.Name != editorSession.Teacher.UserName)
            {
                await Groups.AddToGroupAsync(Context.ConnectionId, editorSession.SignalRStudentGroupName());
            }
            else
            {
                await Groups.AddToGroupAsync(Context.ConnectionId, editorSession.SignalRTeacherGroupName());
            }
            await base.OnConnectedAsync();
        }