Can I Use raiseCustomEventWithCode without joining the room

edited February 2012 in Flash (deprecated)
Can I Use raiseCustomEventWithCode before I join the room, to send message to the server?
I tried this:
Photon.getInstance().raiseCustomEventWithCode(1, {message:"HELLO!"});

but on server side I got trace about error in AMF3 with decoding this message.


  • No, you can't. Raising events is only supported inside of rooms.
    Raising events is used for communication with other clients in the same room. The server just checks the list of receivers (default is all clients in the same room, except the sending client itself) and then sends them the event, but it does not interpret the content of the event in any way.
    if you want to communicate with the server itself, then you will have to use a custom operation therefor.
    You also can send custom ops outside of rooms.
    Custom operations need you to add serverside code, which tells the server how to interpret their payload.
    Therefor you can't add you own custom ops, when using as server, as our cloud currently does not support customizations of the server code.
  • To be clearly, I need a function in AS3, similar to "opCustom" in C#. is it possible?

    I need to call from AS3 some custom server-side function before entering the room.
  • The method you're looking for is sendOperation(). It's protected and the idea behind this is to extend the PhotonCore class and then compose and add operations as needed.

    The Chat Demo and the Scribble demo extend PhotonCore but afaik, they don't implement their own operations. If you need help for this, let me know.