On close, fire an event


is there a better way of doing this thing, what i want is to fire an even on the onClose method, what will i do is when the user is close or logout is account, ill fire an event to those who are connected, saying that the user log out is not connected


What u don’t like about this approach?


sorry late reply, its not working, but i tried this and it works


sir @virk is this ok or do i need to stick to the another one, the another one says the socket topic is not subscribed so i do that


its like this on the first one

strong text


When no one is subscribed to a channel, then this error is raised. I believe Adonis can handle it gracefully vs raising exception.

As far as your code is concerned, it’s all correct. But I will improve the code to make sure, no exception is raised


but i have two users subscribe on both channel

so that;s why i use the another one