public ClientPeer(PhotonApp application, InitRequest initRequest)
            : base(initRequest)
        {
            this.application = application;

            var initObjAsDict = initRequest.InitObject as Dictionary <byte, object>;

            if (initObjAsDict != null)
            {
                this.RequestFiber.Enqueue(() =>
                {
                    var authRequest = new AuthOnceRequest(this.Protocol, new OperationRequest((byte)OperationCode.AuthOnce, initObjAsDict));

                    this.HandleAuthenticateRequest(authRequest, new SendParameters {
                        Encrypted = true
                    }, (NetworkProtocolType)authRequest.Protocol);
                });
                if (log.IsDebugEnabled)
                {
                    log.DebugFormat("auth from init request initiated. p:{0}", this);
                }
            }
            else
            {
                if (log.IsDebugEnabled)
                {
                    log.DebugFormat("no auth from init request. wait for old way auth p:{0}", this);
                }
            }
        }
        protected OperationResponse HandleAuthOnceRequest(OperationRequest operationRequest, SendParameters sendParameters)
        {
            this.authOnceUsed = true;
            var authOnceRequest = new AuthOnceRequest(this.Protocol, operationRequest);

            if (!sendParameters.Encrypted && !this.IsConnectionSecure && this.NetworkProtocol != NetworkProtocolType.WebRTC)
            {
                log.WarnFormat(authOnceGuard, "Got AuthOnce Request from client over unsecure channel. appId:{0}, clientVer:{1}, SdkId:{2}, Debug:{3}, ProtocolType:{4}",
                               authOnceRequest.ApplicationId, this.ClientVersion, this.SdkId, this.ClientUsingDebugLib, this.ProtocolType);

                return(new OperationResponse(operationRequest.OperationCode)
                {
                    DebugMessage = "AuthOnce can not be used over unsecure channel",
                    ReturnCode = (short)ErrorCode.InvalidAuthentication,
                });
            }


            return(this.HandleAuthenticateRequest(authOnceRequest, sendParameters, (NetworkProtocolType)authOnceRequest.Protocol));
        }