What are the differences in Socket vs LiveSocket in app.js?

What are the differences in Socket vs LiveSocket in app.js ?

Does it make sense to use LiveSocket (hence, liveview) by default instead of building anything barebones with Socket if my use case involves

  1. users connecting to a websocket after loading a webpage and continue to receive updates ?
  2. PubSub and Presence is necessary for broadcasting user specific , and module specific events - like user joined the game, user left the game, so on.

Does it make sense to use LiveSocket when using a different frontend for above case? (like react or Vue or angular)

2 Likes

LiveSocket is not meant to be used outside of LiveView.

It is a sort of specialized Socket.

You can use PubSub, Presence and Tracker with both.

Socket goes through channels, LiveSocket through LiveView and use morphdom.

It’s just a simplified view of the system :slight_smile:

3 Likes

Does it make sense to use LiveSocket (and LiveView) without html ? i.e. using react components with LiveView?

1 Like

I would not do this… morphdom is what makes liveview change.

React, Vue and the like have their own reactive system.

But it’s possible. and some have used web components, and let live view manage the state.

3 Likes