On close, fire an event


#1

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


#2

What u don’t like about this approach?


#3

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


#4

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


#5

its like this on the first one

strong text


#6

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


#7

but i have two users subscribe on both channel

so that;s why i use the another one