Photon Plugin Not Receiving data in onEvent callback

edited March 2018 in Photon Server

I am trying to implement a Plugin. Inside OnRaiseEvent i am IPluginHost.BroadcastEvent. I have a Javascript PhotonLoadbalancingClient which receives OnEvent callback with proper Event Code. The prblm is i am not receiving the data. Here is my code

public override void OnRaiseEvent(IRaiseEventCallInfo info)
            IPluginHost host = this.PluginHost;
            int eventCode = info.Request.EvCode;
            int ActorNr = info.ActorNr;

            host.LogInfo("Event Code " + info.Request.EvCode+" ActorNr "+ ActorNr);

            var data = new Dictionary<byte, object>
                    {0, 1},
            host.BroadcastEvent(new int[] { ActorNr }, 0,123, data, (byte)CacheOperations.DoNotCache);
Javascript Client
onEvent(code: number, content: Object, actorNr: number) {
        super.onEvent(code, content, actorNr);"onEvent", code, "content:", content, "actor:", actorNr);
Inside onEvent
code is 123 which is correct
but both content and actorNr both are undefined.
I need to access data which i am passing in Broadcast Event on my Client.

Please help me out


  • JohnTubeJohnTube mod
    edited March 2016
    Hi @abhishek,

    Yes this is a known issue. We should probably update the documentation to cover it.

    Please do a minor change in the way you send events from plugin:


    PluginHost.BroadcastEvent(new int[] { ActorNr }, 0,123, data, (byte)CacheOperations.DoNotCache);

    byte senderActorNr = 0; // change this if you want, plugin/server should have 0 as actor number.
    PluginHost.BroadcastEvent(new int[] { ActorNr }, 0,123, new Dictionary<byte, object>() { { 245, data }, {254, senderActorNr} }, (byte)CacheOperations.DoNotCache);
  • You have switched the codes for "data" and "senderActorNr" in the documentation Costed some time but finally I found this post. Thanks!

Sign In or Register to comment.