Rails 7 E110 Realtime Online User Tracking with Actioncable, Kredis, Turbo Broadcasts
This episode was inspired by the great work of other creators. Hopefully my input tackles some flaws that would appear in a production environment, demistifies some code and potential challanges.
Zero lines of javascript.
Don't store view login in models.
Don't hit the relational database on every web action.
Do you think this can be improved even more? Let me know what you think ๐.
Episode source code: https://github.com/corsego/110-live-users-count/commit/238ab48dd8871b20c30387fd1c64d362992560d8
Based on this blogpost: https://blog.corsego.com/action-cable-broadcast-users-online
Timestamps approach to see users online: https://blog.corsego.com/set-user-status-online
0:00 Other approaches to tracking users online
2:41 Demo of the final application
4:22 Track online users with Kredis, Hotwire Turbo Stream Broadcasts and Action Cable
21:15 Not logged in users can see users online
23:32 Summary
Comments
Featured in playlist:
Recommended based on what you are watching now:

Rails 7 #113 Kredis Live counter, HTTP vs Websocket Turbo Broadcasts

Rails 7 E109 Live vistor count. ActionCable, Turbo Broadcasts, Kredis

Rails 7 #121 Turbo Broadcasts CRUD Demystified

Ruby on Rails #143 Turbo Permanent: persist Audio Video and Search results while navigating pages
