zeromq / czmq

High-level C binding for ØMQ
czmq.zeromq.org
Mozilla Public License 2.0
1.18k stars 525 forks source link

zproxy: Add heartbeat command #2248

Closed jonasdn closed 1 year ago

jonasdn commented 1 year ago

In order to clean out broken TCP connections with the proxy.

Example usage:

    proxy = zactor_new (zproxy, NULL); assert (proxy);

    // Set the frontend (incoming messages)
    char endpoint[64] =  { 0, };
    sprintf(endpoint, "tcp://*:%d", in_port);
    zstr_sendx (proxy, "FRONTEND", "XSUB", endpoint,
        "HEARTBEAT_IVL", "300000", "HEARTBEAT_TIMEOUT", "30000",
        "HEARTBEAT_TTL", "0", NULL);
    zsock_wait (proxy);

Fixes #2244

jonasdn commented 1 year ago

Could something like this, with some kind of heartbeat-command to zproxy be considered? Or is there perhaps a better approach for this problem (#2244) that I am missing?

Thank you!

bluca commented 1 year ago

docs and unit test changes are missing

jonasdn commented 1 year ago

docs and unit test changes are missing

Thank you for review! I added some in force push, let me know if I should refine them!