Is a NetworkTables server's connection listener always called after any preconfigured subscriptions from the connecting client are in place #6700
-
I want the server to send a client a value on an uncached topic as soon as possible after the client connects. If the client code creates the subscription with an associated listener before calling Another approach would be for the client to send the server an "I'm connected" value on an uncached topic from the client's connection listener and have the server listen for the value on that topic instead of listening for the connection. Am I guaranteed that a preconfigured (ie before If neither of those are guaranteed, do I need to listen for changes to |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
(1) is not guaranteed, as it has a race condition. The connection notification occurs when the connection handshake completes; it does not wait for any messages from the client beyond the handshake (e.g. subscribe messages). (2) Yes, this would work. The network messages are sent in order from the client, the preconfigured subscriptions are sent before any other messages/callbacks, and the messages are processed in order on the server. (3) Would work as well. It's on the TODO list to add a nice API for doing this. Note that |
Beta Was this translation helpful? Give feedback.
(1) is not guaranteed, as it has a race condition. The connection notification occurs when the connection handshake completes; it does not wait for any messages from the client beyond the handshake (e.g. subscribe messages).
(2) Yes, this would work. The network messages are sent in order from the client, the preconfigured subscriptions are sent before any other messages/callbacks, and the messages are processed in order on the server.
(3) Would work as well. It's on the TODO list to add a nice API for doing this. Note that
$sub$<topic>
is also available to have (many) fewer things to look at.