Пример #1
0
        protected override void OnClose(CloseEventArgs e)
        {
            //T trash;
            // Sessions.TryRemove(UserId, out trash);

            if (HasICheckable)
            {
                HealthChecker.Remove((ICheckable)this);
            }
        }
Пример #2
0
        protected override async void OnOpen()
        {
            // 클라이언트 버전 체크
            #region CHECK_VERSION
            Version clientVersion = null;
            if (Version.TryParse(
                    Context.QueryString.Get("version"),
                    out clientVersion) == false)
            {
                ErrorClose(CloseStatusCode.InvalidData, "invalid version string");
                return;
            }

            if (new Version("1.0.0") // TODO
                != clientVersion)
            {
                ErrorClose(CloseStatusCode.ProtocolError, "serverVersion != clientVersion");
                return;
            }
            #endregion

            // 로그인
            #region LOGIN
            var userType    = Context.QueryString.Get("userType");
            var userId      = Context.QueryString.Get("userId");
            var accessToken = Context.QueryString.Get("accessToken");

            await ProcessLogin(userType, userId, accessToken);

            #endregion

            OnSessionOpened();

            if (HasICheckable)
            {
                HealthChecker.Add((ICheckable)this);
            }
        }