コード例 #1
0
        public override async Task OnDisconnectedAsync(Exception exception)
        {
            var currentContext = new CurrentContext(_providerUserRepository);
            await currentContext.BuildAsync(Context.User, _globalSettings);

            if (currentContext.Organizations != null)
            {
                foreach (var org in currentContext.Organizations)
                {
                    await Groups.RemoveFromGroupAsync(Context.ConnectionId, $"Organization_{org.Id}");
                }
            }
            _connectionCounter.Decrement();
            await base.OnDisconnectedAsync(exception);
        }
コード例 #2
0
        public override async Task OnConnectedAsync()
        {
            var currentContext = new CurrentContext();
            await currentContext.BuildAsync(Context.User, _globalSettings);

            if (currentContext.Organizations != null)
            {
                foreach (var org in currentContext.Organizations)
                {
                    await Groups.AddToGroupAsync(Context.ConnectionId, $"Organization_{org.Id}");
                }
            }
            _connectionCounter.Increment();
            await base.OnConnectedAsync();
        }
コード例 #3
0
        public async Task Invoke(HttpContext httpContext, CurrentContext currentContext, GlobalSettings globalSettings)
        {
            await currentContext.BuildAsync(httpContext, globalSettings);

            await _next.Invoke(httpContext);
        }