FrontendAddress
How do I use Frontend Address
Below are practical examples compiled from projects for learning and reference purposes
Featured Snippets
File name: ChatClient.cs
Copy
768 private void HandleAuthResponse(OperationResponse operationResponse)
769 {
770 ((IPhotonPeerListener)this).DebugReturn(DebugLevel.INFO, operationResponse.ToStringFull() + " on: " + this.NameServerAddress);
771 if (operationResponse.ReturnCode == 0)
772 {
773 if (this.State == ChatState.ConnectedToNameServer)
774 {
775 this.State = ChatState.Authenticated;
776 this.listener.OnChatStateChange(this.State);
777
778 if (operationResponse.Parameters.ContainsKey(ParameterCode.Secret))
779 {
780 if (this.CustomAuthenticationValues == null)
781 {
782 this.CustomAuthenticationValues = new AuthenticationValues();
783 }
784 this.CustomAuthenticationValues.Secret = operationResponse[ParameterCode.Secret] as string;
785 this.FrontendAddress = (string) operationResponse[ParameterCode.Address];
786
787 // we disconnect and status handler starts to connect to front end
788 this.chatPeer.Disconnect();
789 }
790 else
791 {
792 //TODO: error reaction!
793 }
794 }
795 else if (this.State == ChatState.ConnectingToFrontEnd)
796 {
797 this.msDeltaForServiceCalls = this.msDeltaForServiceCalls * 4; // when we arrived on chat server: limit Service calls some more
798
799 this.State = ChatState.ConnectedToFrontEnd;
800 this.listener.OnChatStateChange(this.State);
801 this.listener.OnConnected();
802 }
803 }
804 else
805 {
806 //((IPhotonPeerListener)this).DebugReturn(DebugLevel.INFO, operationResponse.ToStringFull() + " NS: " + this.NameServerAddress + " FrontEnd: " + this.frontEndAddress);
807
808 switch (operationResponse.ReturnCode)
809 {
810 case ErrorCode.InvalidAuthentication:
811 this.DisconnectedCause = ChatDisconnectCause.InvalidAuthentication;
812 break;
813 case ErrorCode.CustomAuthenticationFailed:
814 this.DisconnectedCause = ChatDisconnectCause.CustomAuthenticationFailed;
815 break;
816 case ErrorCode.InvalidRegion:
817 this.DisconnectedCause = ChatDisconnectCause.InvalidRegion;
818 break;
819 case ErrorCode.MaxCcuReached:
820 this.DisconnectedCause = ChatDisconnectCause.MaxCcuReached;
821 break;
822 case ErrorCode.OperationNotAllowedInCurrentState:
823 this.DisconnectedCause = ChatDisconnectCause.OperationNotAllowedInCurrentState;
824 break;
825 }
826
827 this.State = ChatState.Disconnecting;
828 this.chatPeer.Disconnect();
829 }
830 }
File name: ChatClient.cs
Copy
847 private void ConnectToFrontEnd()
848 {
849 this.State = ChatState.ConnectingToFrontEnd;
850
851 this.chatPeer.Connect(this.FrontendAddress, ChatApppName);
852 }
FrontendAddress 139 lượt xem
Gõ tìm kiếm nhanh...