Adds a delegate to a given API event type that will be used for callbacks.

Namespace: Sfs2X
Assembly: SmartFox2X (in SmartFox2X.dll) Version: 1.7.3.0 (1.7.3)

Syntax

C#
public void AddEventListener(
	string eventType,
	EventListenerDelegate listener
)

Parameters

eventType
Type: System..::..String
The name of the SFSEvent to get callbacks on.
listener
Type: EventListenerDelegate
The delegate method to register.

Examples

 Copy imageCopy
void SomeMethod() {
    sfs.AddEventListener(SFSEvent.CONNECTION, OnConnection);
}
public void OnConnection(BaseEvent evt) {
    bool success = (bool)evt.Params["success"];
    string error = (string)evt.Params["error"];
    Debug.Log("On Connection callback got: " + success + " (error : " + error + ")");
}

See Also