uWebSockets.js icon indicating copy to clipboard operation
uWebSockets.js copied to clipboard

Accessing the subscribed topics in the close handler

Open Vincz opened this issue 4 years ago • 1 comments

Hi! First of all, thank for this wonderful library. My problem is the opposite of #647 . I need to know the topics the ws was subscribed to when it closed. Accessing ws.getTopics() in the close handler return an invalid access.

Would it be possible to give the close handler an extra parameter containing the topics the ws was subscribed to when it closed? Something like: close: (ws, code, message, topics)

As an alternative, it would be great to have access to the list of active topics with the number of subscribers from the app object.

Have a wonderful day!

Vincz avatar Feb 17 '22 06:02 Vincz

Yeah this is a problem, I like how it was before the change. Maybe there needs to be two close events: closing and closed. In case someone needs to know the topics before they are gone, they need to look in closing callback.

ghost avatar Apr 20 '22 05:04 ghost