SDK
SDK Golang v1.x
1

# AddListener

Adds a channel at the end of list of registered channels for that event. Whenever an event is triggered, registered channels are fed in the order they were registered.

# Arguments

Copied to clipboard!
AddListener(event int, channel chan<- interface{})

Argument Type Description
event
int
Event constant from the event package
channel
channel
Event payload channel

# Usage

Copied to clipboard!
ch := make(chan json.RawMessage)
kuzzle.AddListener(event.Connected, ch)
go func() {
  for range ch {
    fmt.Println("Connected to Kuzzle")
  }
}()