Click or drag to resize

SmartFoxAddEventListener Method

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

Namespace:  Sfs2X
Assembly:  SmartFox2X (in SmartFox2X.dll) Version: 1.8.0.0 (1.8.0)
Syntax
C#
public void AddEventListener(
	string eventType,
	EventListenerDelegate listener
)

Parameters

eventType
Type: SystemString
The name of the SFSEvent to get callbacks on.
listener
Type: EventListenerDelegate
The delegate method to register.
Examples
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