コード例 #1
0
        public async Task OpenConnection(
            HubCallerContext context,
            string userName,
            string clientId,
            WebSocketConnectionParameters connectionParameters)
        {
            var session = await sessionService.BeginSession(userName,
                                                            connectionParameters.AccountId,
                                                            clientId,
                                                            connectionParameters.AccessToken,
                                                            connectionParameters.IsSupportUser,
                                                            connectionParameters.DeviceSessionKey);

            connectionRepository.Add(context.ConnectionId, context);
            sessionIdRepository.Add(context.ConnectionId, session.SessionId);

            if (!connectionParameters.IsConcurrentConnection)
            {
                var terminateOtherTabs = new TerminateOtherTabsNotification
                {
                    DeviceSessionKey        = connectionParameters.DeviceSessionKey,
                    OriginatingConnectionId = context.ConnectionId,
                    OriginatingServiceId    = AxleConstants.ServiceId
                };

                await notificationService.PublishOtherTabsTermination(terminateOtherTabs);
            }
        }