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?
lutzhorn
(Lutz Horn)
September 2, 2020, 3:01pm
2
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.
lutzhorn
(Lutz Horn)
September 3, 2020, 7:20am
4
So is this line reached?
Aghaaz_Butt:
panic(err)
Is there any ouput of this panic? What is the error err
?
lutzhorn
(Lutz Horn)
September 3, 2020, 7:27am
6
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)
}
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.
emitter-io:master
← lzh2nix:fix-deadlock-when-waitcallback-and-OnMessage
opened 12:59AM - 29 Aug 20 UTC
system
(system)
Closed
December 6, 2020, 7:03am
11
This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.