We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
This is the code for emit on the top level (not namespace) with considerations of subscribers
// forward emitted event to subscribers this.on(name, (...params) => { // flatten an object if no spreading is wanted if (params.length === 1 && params[0] instanceof Object) params = params[0] for (const socket_id of this.namespaces[ns].events[name].sockets) { const socket = this.namespaces[ns].clients.get(socket_id) if (!socket) continue socket.send(this.dataPack.encode({ notification: name, params })) } })
This emit didn't consider subscribers of the events, and will broadcast to the namespace clients regardless subscribed or not
/** * Emits a specified event to this namespace. * @inner * @method * @param {String} event - event name * @param {Array} params - event parameters * @return {Undefined} */ emit(event: string, ...params: Array<string>) { const socket_ids = [ ...self.namespaces[name].clients.keys() ] for (let i = 0, id; id = socket_ids[i]; ++i) { self.namespaces[name].clients.get(id).send(self.dataPack.encode({ notification: event, params: params || [] })) } },
The text was updated successfully, but these errors were encountered:
Definitely shouldn't be like that. PR welcome!
Sorry, something went wrong.
No branches or pull requests
This is the code for emit on the top level (not namespace) with considerations of subscribers
This emit didn't consider subscribers of the events, and will broadcast to the namespace clients regardless subscribed or not
The text was updated successfully, but these errors were encountered: