SDK
SDK Golang v3.x
2

Once #

Adds a one-time channel to an event.

The next time the event is triggered, this channel is removed and then fed.

Whenever an event is triggered, channels are fed in the order they were registered.

Channels removed this way are not closed.

Arguments #

Once(event int, channel chan<- interface{})

ArgumentTypeDescription
event
int
Event constant from the event package
channel
channel
Event payload channel

Usage #

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