Difference between Events and Operations

edited October 2011 in Photon Server
Hi,
I've looked at the blanks server exemples and the photon custom events and photon custom operations pdf from this topic
viewtopic.php?f=5&t=107
but the codes in OnOperationRequest seems the same for events and operations request and i dont know how to make the difference.
maybe with the operations code but im not sure.
One more thing that I do not understant is:
[EventParameter(Code = 100, IsOptional = false)]

in this code
using Photon.SocketServer.Rpc;
public class MyCustomEvent : Event
{
[EventParameter(Code = 100, IsOptional = false)] 
public string Message
{
get; set;
}
}

PS: Sory for my bad comprehention of the c# (i learn it since two weeks) and sorry for my bad english.
PS2: If people with more expercience than me can explain me those things it would be very useful for me.

thanks in advance.

Comments

  • An Operation is a 'network function' basically called from the clients on the photon server.
    While an event is just 'a data packet sent across the net' normally used for client -> client information (where the server only relays the information) or when the server wants to inform a client about something independent of an operation called from that client (for example when you are hit and take damage due to another player)
  • [EventParameter] is photon 2 specific, in photon 3 it's [DataMember].
    This attribute is used to map a property to a byte key (and the other way around).
    On client side you can access the Message in the event hashtable/dictionary with this key, for instance "string message = (string)data[100]".
    OperationRequests are for client-to-server communication, OperationResponses for server-to-client (as a response on an OperationRequest) communication and Events for all other server-to-client notifications which includes data that is sent from one client via the server to other clients.
  • Ok thanks for yours answers.
Sign In or Register to comment.