Emitter Key Generation of channel

I need to generate a channel key from the backend using emitter.

// 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?

What is c? And what is not working? Does the code panic?

The ‘c’ is emitter broker
c, _ := emitter.Connect(host, func(_ *emitter.Client, msg emitter.Message) {
fmt.Printf("[emitter] -> [B] received: ‘%s’ topic: ‘%s’\n", msg.Payload(), msg.Topic())
})
The issue is, Code isn’t coming in panic block and not evening going to next execution line.

So is this line reached?

Is there any ouput of this panic? What is the error err?

What is the “emitter” library?

There isn’t any output of this panic.

// 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())
})

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

Using https://github.com/emitter-io/go

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

there was an issue in the emitter-io library, which is fixed now.

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.