Soketi / Channel, private channel and presence channel
Hello,
The application is with Laravel and VueJS.
The users have roles in the application. According to the role, they don't have the same rights to see or handle the datas.
The application is realtime via soketi and the screen displays the datas in real time according to any change. If a user changes a data, another connected use will see immediately the modification on his screen. To have this possible, I send an event with the changed data via soketi.
Here is the situation :
-
datas : id, name, description, category_id, configuration
-
admin can see all datas
-
user A can see datas in category 1
-
user B can see datas in category 2
-
user C can see datas in category 2, but only the name and the description (and not the configuration)
-
admin moves a data from category 1 to category 2
The result :
-
user A sees a data disappearing from his screen
-
user B sees a data appearing on his screen with all informations (name, description, configuration)
-
user C sees a data appearing on his screen with only the name and the description
What I want :
-
send a delete event to user A with the data id to be removed from the array of datas displayed on his screen
-
send a create event to user B with the whole data object (name, description, configuration) to be added to the array of datas displayed on his screen
-
send a create event to user C with the data object with only the name and the description to be added to the array of datas displayed on his screen
My ideas to do that :
-
have a presence channel to know who is connected
-
generate the datas to send via soketi for each role in the application (admin, member, user)
-
when a user is connected, he is listening to his own private channel (or channel ?)
-
send the authorized datas to each connected user according to his role
What do you think about my idea ? What difference will be between a private channel and a channel ?
Do you have other suggestions to do that ?
Thanks for your help.
V
Please or to participate in this conversation.