Using Websockets for all communication - Good idea or bad?

I’m building a react/elixir web app (not server side rendered if it makes a difference) where currently all communication is done over websockets. Basically, a user connects to the socket, then over various different pages, joins and leaves different channels.

So far I haven’t seen any issues (currently in production - although it’s only me testing it) but not sure if I am missing something here.

Is there something I am possibly missing as to why this would be a bad idea?

1 Like

Phoenix is perfectly capable of handling huge numbers of simultaneous websocket connections. You might find this blog post (which is already back from 2015!) insightful:

2 Likes

Two downsides I can think of offhand:

  1. No caching, the user’s browser and any intermediate network devices cannot cache WebSocket content.
  2. Bad for search engines. Some search engines crawl JS but I don’t think any of them will open WS connections to get your page content.

Whether these are problems or not depends on your needs.

3 Likes