Questions about Phoenix channels, VueJS and 3G/4G/WiFI Internet connections

I understand that Phoenix channels can manage communications from server to client side web browser. I never used them. My Question, has anyone had success using Phoenix channels along with Phoenix JSON API back-end, VueJS on front-end? Is it possible to listen to Phoenix channels from a VueJS application?

Second question, is Phoenix channels reliable when used over WiFi or mobile data? Or is 5-second-interval server pull techniques better?

Yes, although the API back-end is irrelevant in terms of channel communication, since you’ll be communicating through the socket and handles (similar to controller actions). It’s great if you need 2 way communication and you would like to keep the same interface for that 2 way comm. It also falls back to long-polling if websockets aren’t available.
If you’re mostly interested in server side broadcast alone (1 side comm, server->client) then server-side events are more appropriate. Regarding WiFi or mobile data that depends, you mean when accessing over a regular continuous act, it should be, but again, you might want to look into server-side events as it seems they simplify that a great deal.

My concern regaring channels, sockets and WiFi/3G is about reliability. What happens to a subscriped channel if the line drops for 2 seconds or the client changes from WiFi to 3G or vise versa, etc…

If you need information buffered between reconnects then phoenix does ‘some’ of that but otherwise you need a cache process. :slight_smile:

https://hexdocs.pm/phoenix/channels.html#resending-server-messages

2 Likes