ami-iit / yarp-openmct

Repo for YARP and OpenMCT integration.
BSD 3-Clause "New" or "Revised" License
6 stars 1 forks source link

Closure Subset B #53

Closed nunoguedelha closed 2 years ago

nunoguedelha commented 3 years ago

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 of websocket.pause(), and it...

pauses the reading of data. That is, 'data' events will not be emitted upon arrival of incoming packets (https://nodejs.org/api/net.html#socketpause).

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:

Originally posted by @nunoguedelha in https://github.com/ami-iit/yarp-openmct/issues/40#issuecomment-950975871