Pub/Sub stops after first message has been received.
See original GitHub issueI am absolutely new to nanomsg, so I might be doing something really stupid, but I can’t get this simple PUBSUB example to work:
var nano = require('nanomsg');
var addr = 'tcp://127.0.0.1:7789'
var pub = nano.socket('pub');
pub.bind(addr);
var sub1 = nano.socket('sub');
sub1.on('data', function (buf) {
console.log('sub1:' + String(buf));
});
sub1.chan(['topic1'])
sub1.connect(addr);
var sub2 = nano.socket('sub');
sub2.on('data', function (buf) {
console.log('sub2:' + String(buf));
});
sub2.chan(['topic2'])
sub2.connect(addr);
setInterval(function () {
console.log('sending');
pub.send("topic1 Hello from nanomsg!");
console.log('sent');
}, 1000);
Running this gives me:
sending
sent
sub1:topic1 Hello from nanomsg!
And then there is nothing more (even if the node process does not exit). I would expect the setInterval to do this repeatedly, but after the first message has been received there is nothing more.
Any ideas? I have tried this on nodejs 5.11.0 on my Mac and on 6.2.0 on an Ubuntu machine.
Issue Analytics
- State:
- Created 7 years ago
- Comments:30 (3 by maintainers)
Top Results From Across the Web
Google Pub/Sub Subscriber not receiving messages after a ...
Publishers just stop publishing messages and therefore there are no messages to receive. If you restart the subscriber and it starts receiving ......
Read more >Pubsub stops receiving messages #5314 - GitHub
After a day or two of the subscriber running, it stops consuming the messages. I have to manually restart it to make it...
Read more >Troubleshooting | Cloud Pub/Sub Documentation
Learn about troubleshooting steps that you might find helpful if you run into problems using Pub/Sub. Cannot create a subscription. Check that you...
Read more >PubSub Pull Subscriber stops receiving messages randomly
I have a GKE cluster with three nodes, which are being subscribers to the same PubSub subscription. and polling continuously for new ...
Read more >Ability to rate limit messages being sent from a topic to a ...
When Pub/Sub uses a push backoff, it stops delivering messages for 100 milliseconds to 60 seconds and then starts delivering messages again. ......
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

k thanks, yea i’m not a fan of this code: https://github.com/nickdesaulniers/node-nanomsg/blob/master/lib/index.js#L440
We need to fix this
@reqshark Here is a pull request https://github.com/nickdesaulniers/node-nanomsg/pull/160, thanks for helping out.