Help with basic Photon Custom Operation tutorial

edited August 2010 in Photon Server
Hi. im working of the PDF supplied in the doc folder..

on my client i have:
this.Peer.OpCustom(1, new Hashtable { { 100, "Hello World" } }, true);

then in the server Peer OnOperationRequest:
var response = new OperationResponse(request, 0, "OK", new Dictionary<short,object> { { 100, "Hello yourself!" } } );

this.PhotonPeer.SendOperationResponse(response);

which results in the following casting error:
InvalidCastException: Cannot cast from source type to destination type.
ExitGames.Client.Protocol.serializeParameters (System.Collections.Hashtable _parameters, Boolean useDummy, Byte opCode, Int16 invocID, System.Byte[] header) [0x00000]

advice/thoughts please.

Comments

  • this.Peer.OpCustom(1, new Hashtable { { 100, "Hello World" } }, true);
    
    the parameter key in the client lib needs to be a byte, but here it is an integer.
    fixed:
    this.Peer.OpCustom(1, new Hashtable { { (byte)100, "Hello World" } }, true);
    

    EDIT: obviously a bug in the pdf.. sorry for that
  • doh.. i KNEW it was something pretty obvious.. thanks for spelling it out!
Sign In or Register to comment.