Quantcast
Channel: Active questions tagged rest - Stack Overflow
Viewing all articles
Browse latest Browse all 3667

For new app, is there any reason not to use websocket instead of rest? [closed]

$
0
0

Leaving aside dev experience with one or the other, browser and library support, what is the benefit of using old rest technology instead of websockets, for a typical client-server app ?

As I see it, whatever you can do with rest you can do with websockets, but actual development work appears to be simpler using ws.

with rest I need some kind of routing logic on the server, then I need to follow some http standards, statuses, content-type, CORS, and in case of large apps I may even need to use external libs such as express. On the client I need to call fetch and pass the data in different ways based on the request method.

with websockets, the only routing I need is on the client, no need to follow any standard, I can just send/receive everything in the same way as JSON, no CORS to worry about, no need for external libs on the server to handle routing. And as a bonus I can have two-way communication with the server.

Am I missing something, or ws is just better in every way if we leave out the things I mentioned in the begining of the post.


Viewing all articles
Browse latest Browse all 3667

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>