Reputation: 1654
This is not a straight question but rather a call for opinion.
I am in the process of designing an API using NodeJS and I would really need sockets for some applications but not for all.
Is it good practise to mix both Socket.IO and normal Express REST API point ? what are your opinions ? What would be the advantages and disadvantages to do the mix up ?
Upvotes: 1
Views: 1442
Reputation: 30766
It's entirely fine to use HTTP endpoints and websockets, as until HTTP/2 came along, the only solutions to getting updates back from background processes were:
Neither of these are ideal, but luckily HTTP/2 with Server Push means you can stream down updates as they come, making WebSockets not quite so required.
That said if you have other use cases for WebSockets then absolutely, off you go!
Relevant: https://www.infoq.com/articles/websocket-and-http2-coexist
Upvotes: 2