Detect Disconnection events on SUB socket?
How to detect Disconnection event on a PUB socket?
I used:
let mut monitor = socket.monitor(); and monitor.try_next() on a thread. The only event that I got is SocketEvent::Connected even if I manually stopped the Publisher side on purpose.
How to detect SocketEvent::Disconnected?
Hmm I'll have to try this out. I've been wanting to see if these work.
On Thu, Nov 14, 2024, 06:32 Odysseas Gabrielides @.***> wrote:
How to detect Disconnection event on a PUB socket?
I used:
let mut monitor = socket.monitor(); and monitor.try_next() on a thread. The only event that I got is SocketEvent::Connected even if I manually stopped the Publisher side on purpose.
How to detect SocketEvent::Disconnected?
— Reply to this email directly, view it on GitHub https://github.com/zeromq/zmq.rs/issues/201, or unsubscribe https://github.com/notifications/unsubscribe-auth/AEIQCA63DE54O6H73UJXNPL2ASC3TAVCNFSM6AAAAABRYVWNQSVHI2DSMVQWIX3LMV43ASLTON2WKOZSGY2TQNJUGU2DIMY . You are receiving this because you are subscribed to this thread.Message ID: @.***>
@CableSynth Cool, let me know if you manage to do this
It looks like this might not be implemented? If you look at REP sockets, they send a Disconnected event to the monitor when the peer disconnects:
https://github.com/zeromq/zmq.rs/blob/07c65dcfca2cc8189af852346c0da60da540027d/src/rep.rs#L93-L98
However, SUB sockets do not do this.
https://github.com/zeromq/zmq.rs/blob/07c65dcfca2cc8189af852346c0da60da540027d/src/sub.rs#L110-L112
I'm not a ZeroMQ expert but this may just be an oversight.
Also haven't found a way to get a subscriber to understand that a publisher has disconnected. I can make an application level solution but this would only work if the publisher gracefully shuts down...
This is essential for implementing robust services/applications so priority should be high imo; I need this ASAP so could try and contribute but don't see any guidelines/support docs? (I guess the answer is just to get stuck in)
The same issue exist on PUB sockets. I am working on a PR.