Server2Server Send operationRequest betwin servers

Options
serialkil3r
edited August 2013 in DotNet
Im strugling after finishing the server2server tutorials, now im continuing working on it, but i cant see to find how to send an operation request to the Subserver from the master server

the commented code prints nothing on login server, i tried a few bunch of code but no avail. can anyone point me how to do it please.

[code2=csharp]protected override void OnDisconnect(PhotonHostRuntimeInterfaces.DisconnectReason reasonCode, string reasonDetail)
{

Log.DebugFormat("Removed Disconnected Peer [detail: {0} ConnID: {1} userID: {2}]", reasonDetail.ToString(), ConnectionId, UserId);

//need to send request to LoginServer

//var request = new OperationRequest((byte)UnitySubOperationCode.LoginSecurely,
// new Dictionary<byte, object>
// {
// {(byte)UnityParameterCode.Disconnect, "DISCONNECTED"},
// {(byte)UnityParameterCode.UserId, UserId}
// });

//_server.SubServers.LoginServer.SendOperationRequest(request, new SendParameters());

_server.ConnectedClients.Remove(UserId);
}[/code2]

Best Regards.

Comments

  • Hello,

    to which tutorial are you referring?

    Your code looks okay, so I guess that your "LoginServer" peer is either disconnected or that you look for the incoming operation request in the wrong place.

    - Have you made sure that the OnDisconnect() method is actually called? (I.e., is the debug log message actually printed?)

    - Is that "LoginServer" a ServerPeerBase (i.e., an outbound connection) or a PeerBase (inbound connection)? Which peer type is created on the "other" end? Can you please show me the code for that class (at least), or zip up your complete source code (including PhotonServer.config), upload it somewhere and send me a link to download it per PM, please?
  • I got it working i was switching SubOperation code with UnityPeerCode

    So here it is the code for further reference:
    [code2=csharp]var request = new OperationRequest((byte)UnityPeerCode.Login,
    new Dictionary<byte, object>
    {
    {(byte)UnityParameterCode.Disconnect, "S2SD"},
    {(byte)UnityParameterCode.SubOperationCode, (byte)UnitySubOperationCode.Disconnect},
    {(byte)UnityParameterCode.UserId, UserId}
    });


    _server.SubServers.LoginServer.SendOperationRequest(request, new SendParameters());[/code2]
  • Thanks for coming back and sharing your solution!