You’re not receiving notifications from this thread.
Group Chat with ActionCable: Part 2 Discussion
Is it possible to make a REST API for this app and create a Mobile app using Jquery mobile or Android and do real time chat with people chatting on desktop?
I have an application with Rails 5, Action Cable and Devise. I am planning to create mobile app to let mobile users do realtime chat with users on desktop or any other device. My website is device responsive but I am wondering if we can create a mobile app with REST API and do real time chat with Action Cable? Or is Action Cable only applicable to desktop users?
Basecamp uses Turbolinks and the ActionCable JS on mobile to power their app, however I'm sure you could port the client over to a native Swift or Obj-C client that would allow you to build a native app. It'll probably be a decent amount of work to start, but this is an example of someone who build an ActionCable client in Ruby (rather than the default JS) so you could probably use it as a basis for building a Swift client.
If you just go with Turbolinks views on mobile, you'll have a really easy time making this all work because the mobile UI will be the exact same code you use on the desktop browser.
Hi, When I try to leave the second (and last) chatroom I joined, I get this error instead of returning me to the chatroom path: https://uploads.disquscdn.c...
My routes look fine to me (when comparing to the source code), so i'm not sure why it isn't working.
Nevermind, `chatrooms_path` shouldn't have the `@` before it! I hope this helps someone else coming across this.
@excid3:disqus awesome tutorial series!
You've said around 6:15 it would be good to add indices to the chatroom_users table. I just can't figure out of to add an uniq index for the chatroom and user references. Do you got a tip for that?
Hi Chris, can you explain again what the "before_action :set_chatroom" in the ChatroomUsers controller does? Does it just point all the join and leave methods to the specific chatroom id?
Because this controller is used to manage who is actually subscribed to a chatroom, we always include the chatroom ID in the URL. Then we just look up the chatroom and permanently add or remove the join table records to denote who is in the room or not. So yes, basically what you were saying. It's auto-scoping the actions its taking by the chatroom ID in the URL.
I have implemented this system in my own project. A problem I have is that I do not know when to destroy_all users (as you have done) when the user closes the website for example. How can I detect if they have left the site, and therefore their record in ChatroomUsers needs to be destroyed? I am using this also to show how many active users are in the chatroom, and the number does not go down when the user leaves by closing their browser because of this. Thanks.