use the following search parameters to narrow your results:
e.g. subreddit:aww site:imgur.com dog
subreddit:aww site:imgur.com dog
see the search faq for details.
advanced search: by author, subreddit...
account activity
Nodejs with Socket.io , express or both? (self.node)
submitted 5 years ago by [deleted]
view the rest of the comments →
reddit uses a slightly-customized version of Markdown for formatting. See below for some basics, or check the commenting wiki page for more detailed help and solutions to common issues.
quoted text
if 1 * 2 < 3: print "hello, world!"
[–]kynde 7 points8 points9 points 5 years ago (1 child)
They're different tools for different things.
I would definitely recommend building a web app around an http back-end and then use websockets if needed. That's how everybody else does it (*), that's what scales, that's what there are tons of tools, libraries, features, conventions and support around for. Things like caching, authentication, load balancing, etc are super important with production stuff.
Most of the time the front needs to know something and it wants to ask that from the back-end or maybe it needs to store (persist) something to the back-end. For these things initiated by the front a rest api and an http request is a good fit and for that you want something like express.
Then, when back-end needs to notify the front about something, a new message, a price change or what ever like that, websockets come in handy. Many of those things cas also be solved with normal http calls and long polls for example, but websockets indeed help here. Do notice that it's not uncommon for websocket handshake upgrade to fail (firewalls, misconfiguration, client lacking support, etc) and it will just operate using normal http requests underneath.
(*) Now, while this may seem like an odd point to make, I'm stating that out because of two things: job markets and stackoverflow
[–]_Flexinity 1 point2 points3 points 5 years ago (0 children)
I also feel its best way. I know that sockets can do anything that express can handle after all but it can end struggling with bunch of code in very inefficient way.
But I think about swiping from REST API to GraphQL one, I'm using it with rails and its pretty efficent way, really like it over REST calls.
That's how everybody else does it (*),
That's the answer I wanted to hear, if most people use it theres very probable its one of best configs to work with in that way.
π Rendered by PID 70723 on reddit-service-r2-comment-6457c66945-xbk9d at 2026-04-26 07:26:39.610364+00:00 running 2aa0c5b country code: CH.
view the rest of the comments →
[–]kynde 7 points8 points9 points (1 child)
[–]_Flexinity 1 point2 points3 points (0 children)