Skip to content

Commit

Permalink
fix: emit first part of method which is module name
Browse files Browse the repository at this point in the history
  • Loading branch information
frankpagan committed Nov 28, 2023
1 parent 88fee8a commit d5d2f2d
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -403,8 +403,11 @@ class SocketServer extends EventEmitter {
if (authorized.authorized)
data = authorized.authorized

this.emit(data.method, data);

let mod = data.method.split('.')[0]
if (['storage', 'database', 'array', 'index', 'object'].includes(mod))
this.emit(data.method, data);
else
this.emit(mod, data);
}
}
} catch (e) {
Expand All @@ -414,6 +417,7 @@ class SocketServer extends EventEmitter {

async send(data) {
// const socket = this.sockets.get(data.socketId)
delete data.wsManager
const socket = data.socket

if (data.sync) {
Expand Down

0 comments on commit d5d2f2d

Please sign in to comment.