(Note: hypothetical code examples below are in context of example chatting app)
(Note: I’m also beginner, so I apologize for any misunderstanding in the upcoming text)
Hello,
I’d like to ask how should I construct my channels.
Now I’m standing on the beginning and I dont know how to start… Most examples show how to create channel with topic: room:room_id
. Thats ok, I understand that. But what about events such as room_created
, room_renamed
, room_deleted
. Is it OK to write a channel with dedicated topic for such events? Also, where should I put code for broadcasting such events? Would it be inside the responsible socket’s handle_in("create_room" ...)
(the one that originally issued a request for creating new room)? Or should I have some sort of PubSub
baked into my business logic code that would accept that “new room” has been created and forward this information to interested sockets/channels? (if so, would it be a dedicated channel for this?)
Thanks in advance