DEV Community

Discussion on: request-response pattern with socket.io, Am I using anti pattern ?

Collapse
vbarzana profile image
Victor A. Barzana • Edited on

Oh crap, I know what you mean, just going through it now, I found this library npmjs.com/package/socket.io-request but it is not touched since 2018, let me know if you find a better solution, otherwise we have to come up with something. I remember back in the day when we were implementing jWebSocket framework, RIP, we had set up a very nice request/response mechanism by introducing to every request a requestId autogenerated id and matching every message on the client back to this requestId on the client for every message, this could be a lot of overhead, but would allow you to add any kind of callback hell or promises on the response which was way more intuitive.

Collapse
vbarzana profile image
Victor A. Barzana

Ah, nope, ignore this library npmjs.com/package/socket.io-request they don't have a proper r/r mechanism there, not recommended.