Disconnect with reason (Mmodemo)

edited November 2010 in Photon Server
I'm trying to achieve following behavior:
client sends some data to server for check (operation request) and then if that check ends successfully server sends answer (operation response with OK), but if check fails server must disconnect client and say why he has disconnected. But i can only call peer.PhotonPeer.Disconnect() with no parameters.

There's OnDisconnect callback on client side
public void OnDisconnect(Game game, StatusCode returnCode) { ... }
and ideally i want to recieve some custom code here and pop window with description why client got disconnected. But i can't call Disconnect with parameter, neither i can even add something to StatusCode enum, because it is inside PhotonUnity3D.dll. Calling Disconnect() returns DisconnectedByServerLogic code, which is not very descriptive in my case.

Any way to achieve this?

Comments

  • it's true, you can't change this.
    To work around you can send an operation response with an error code.
    Then either the client logic has to disconnect or you force the disconnect from the server side a second or so later.
  • well, i already did that: enqueued disconnect 500 ms after sending response with error. i can't call disconnect from client's side because i don't "trust" client (server controls this).
    seems i have to change way of disconnect description and don't use statuscode in OnDisconnect. Thanks for help.
  • Faced another problem:
    After disconnecting with 'DisconnectByServerLogic' PeerState of the PhotonPeer remains 3 and next time i try to reconnect, it fails due to requirement of PeerState to be 0 (saw that in PhotonUnity3d.dll in reflector: in EnetPeer.Connect(...) method). And as you may guess i can't set PeerState...
  • might be a bug - we will look into it..
    to work around it you can always use a new PhotonPeer instance.
Sign In or Register to comment.