onEvent

inline fun <T : Any> onEvent(name: String, crossinline listener: (T) -> Unit)

Listens to a specific gateway event

See user docs for a list of possible events

Parameters

name

The name of the event (Case insensitive).

listener

The method that gets called when the gateway event is received, it is passed a deserialized model of type T.


fun <T> onEvent(name: String, clazz: Class<T>, listener: (T) -> Unit)

Listens to a specific gateway event

See user docs for a list of possible events

Parameters

name

The name of the event (Case insensitive).

clazz

The type that the event's data should be deserialized to.

listener

The method that gets called when the gateway event is received, it is passed an instance of clazz.