Rails 5 introduced Action Cable, but in Rails 4 there was Live Streaming. So I'm very much confused what's the difference in both and is Live Streaming is dead in rails 5 ? or Action Cable is much improved version of Live Streaming API's
Live streaming
Live streaming is the feature that can be used for receiving and sending data. Streaming gets data from one client and then live sends to another client. But in real time there this is one way communication. client request must be made for live streaming.
For instance, the client can request a file such as an MP3 or video, and ActionController::Live can stream that data to the client.
Action Cable Websocket
Action Cable uses web socket and it handles two way communication. This is used for realtime purpose like chat where server automatically sends data to client without making request by client.
For example, a chat room where multiple clients are communicating with the Rails server would need a real-time connection to keep the stream of data flowing. ActionController::Live would not be able to provide that.
© 2022 - 2024 — McMap. All rights reserved.