Help on Emitter for Generating Channel Key

I need to generate a channel key from the backend using emitter.
Library: https://github.com/emitter-io/go

// Create the client and connect to the broker
    c, _ := emitter.Connect(host, func(_ *emitter.Client, msg emitter.Message) {
        fmt.Printf("[emitter] -> [B] received: '%s' topic: '%s'\n", msg.Payload(), msg.Topic())
    })

    key2, err := c.GenerateKey(masterKey,newChannel, "rwls", ttl)
    if err != nil {
        panic(err)
    }

    fmt.Println(key2)

I am not getting any errors, but also not receiving any messages. Any idea what’s wrong here?

emitter.Connect returns an error as its second parameter but your sample is ignoring that value. Check to see if it’s non-nil.

1 Like

there was an issue in the emitter-io library, which is fixed now.
https://github.com/emitter-io/go/pull/28/files