What are the distinctions between operations and events?

Options
storm33229
edited March 2013 in Photon Server
In my situation (I am doing stuff just to learn Photon), I create an entity when a new client connects to the host:
        protected override PeerBase CreatePeer(InitRequest initRequest)
        {
            var peer = new Peer(initRequest.Protocol, initRequest.PhotonPeer);

            EventData createEntityEvent = new EventData((byte)EventCodes.CreateEntity);
            createEntityEvent.Parameters = null;

            peer.SendEvent(createEntityEvent, new SendParameters());

            return peer;
        }

I happened to notice that the host was not capable of sending an operation to the client; instead, it needed to send an event. At least, this is what I did to make it work 8-)

I didn't see a lot of mention about Events in the reference material - under "Operations & Events" there is decent material on sending Operations, but I could not find anything on Events aside from how they are implemented on top of Lite & LiteLobby (which is not what I am using).

What are the distinctions between operations and events?

Comments

  • chvetsov
    Options
    Events (like client was moved, healed, teleported) happen on server, and you notify clients about this by sending Event
    Operation happens on client. Client sends some request to server to perform some action or operation, like 'move me', 'heal me', 'teleport me'. if server will approve this request, then event on server happens

    There is mostly logical distinction
  • chvetsov wrote:
    Events (like client was moved, healed, teleported) happen on server, and you notify clients about this by sending Event
    Operation happens on client. Client sends some request to server to perform some action or operation, like 'move me', 'heal me', 'teleport me'. if server will approve this request, then event on server happens

    There is mostly logical distinction

    Ok, sounds simple enough. Is this in the reference section?
  • Yes: http://doc.exitgames.com/photon-server/BasicConcepts/ gives a high-level explanation of operations and events, and http://doc.exitgames.com/photon-server/ ... perations/ has some more details. :)
  • Nicole wrote:
    Yes: http://doc.exitgames.com/photon-server/BasicConcepts/ gives a high-level explanation of operations and events, and doc.exitgames.com/photon-server/CallingOperations/ has some more details. :)

    Yeah I figured I had just missed it! :oops: