Realtime Group Chat with Rails [Revised] - Part 2 Discussion
Nice video Chris.
I did something similar on a project a while ago but not with the elegant stimulus js solution.
Something that I am wondering about Websockets. In terms of edges cases or pitfalls that one could fall into pretty easily, what are some good ones to look out for?
Thanks Chris! I'm hoping for another episode in the series for direct messages.
Hi Chris,
I'm not sure if anyone has found this same issue, but I can't get the action to clear the input to fire in the stimulus controller. I'm using Rails 6.1.3, although I don't know if that makes a different. It's almost as if the ajax:success event is never fired or never detected. I can get an action to work on the submit event for the form, but none of the ajax events appear to work.
I just found out. It seems I needed to add local: false to the form. Now it works. Unrelated, I keep getting warnings about data-target-channel being deprecated in favor of data-channel-target.
Note: Following along with Rails 7.1.3.2 and deleting message_channel.js
as mentioned at 12:11 causes both connections to stop working. I deleted all the contents of the message_channel.js
file, but kept the file itself and it appears to only be connecting to the channel with the channel ID once as expected