The actual core implementation of pause is probably somewhere deep into engine.io and hard to find, but I believe it does the job. Tested it on the framework:
we replace the server closure steps in handleTermination() by telemServerTracker.pauseAll(); which calls pause() on the tracked sockets of the telemetry server.
function handleTermination(signal) {
console.log('Received '+signal+' ...');
telemServerTracker.pauseAll();
}
if after opening the visualizer tab and clicking on a telemetry entry (e.g. "IMU measurements"), we hit <CTRL+C>, and then click on any new telemetry entry, the realtime data won't be updated, just the historic.
The historic requests were still working because we didn't close the server, which would keep it from listening to new connections (the history request always creates a new connection).
Fixed by #52
B - Stop listening to client requests ("subscribe"/"unsubscribe" events) on the existing connections
Used
net.socket.pause()
(https://nodejs.org/api/net.html#socketpause) to stop reading request messages on the sockets. This seemed to be the simplest approach.Indeed,
net.socket.pause()
is the implementation ofwebsocket.pause()
, and it...The actual core implementation of pause is probably somewhere deep into
engine.io
and hard to find, but I believe it does the job. Tested it on the framework:we replace the server closure steps in
handleTermination()
bytelemServerTracker.pauseAll();
which callspause()
on the tracked sockets of the telemetry server.<CTRL+C>
, and then click on any new telemetry entry, the realtime data won't be updated, just the historic.Originally posted by @nunoguedelha in https://github.com/ami-iit/yarp-openmct/issues/40#issuecomment-950975871