HenningM / express-ws

WebSocket endpoints for express applications
BSD 2-Clause "Simplified" License
877 stars 142 forks source link

pause() and resume() removed from 3.x to 4.x #106

Closed Ylianst closed 5 years ago

Ylianst commented 6 years ago

I make heavy use of pause() and resume() to perform flow console on the web sockets. When updating to express-ws 4.x, the pause/resume methods don't seem to be present anymore and I can't find any alternatives. Help appreciated. - Thanks.

HenningM commented 5 years ago

Hey @Ylianst,

These methods were indeed removed from the underlying ws library. Refer to the comments on this commit for some hints on how you can still achieve the functionality you're after: https://github.com/websockets/ws/commit/a206e986fcdbf6f71d008c910fdd60f5141ba7ac. I don't know if I would recommend doing it this way, but unfortunately I don't have any better suggestions for you either.

Ylianst commented 5 years ago

Ok, I can do the same using ws._socket.pause() and ws._socket.resume(). It's not a nice looking and flow control management is, in my view, a critical part of any stream protocol. This functionality should not be hidden, rather it should be part of the base documentation and examples. Regardless, I can work with this.