Websocket vs Long Polling for Phoenix?

Websocket vs Long Polling for Phoenix what is the best choice?

The only answer that matters:

“It depends”

Seriously though, without more context it’s meaningless to recommend one over the other. There’s times long polling is appropriate, there’s times websockets are appropriate.

Typically with a Phoenix channel you’d be using websockets as the transportation layer, unless you have some requirements where websockets cannot be used.

1 Like

Which will be supported by Phoenix in the future?

Websockets are better because they were designed for bi-directional communication. Longpolling is a hack and you should only use if it you cannot use websockets.

1 Like