Don't send a package id for commands as it's not needed

This commit is contained in:
2021-04-26 17:29:57 +02:00
parent 971c92b21a
commit 1646bbbe3b
2 changed files with 2 additions and 3 deletions

View File

@@ -168,7 +168,6 @@ class SocketlibSocket {
_sendCommand(handlerName, args, recipient) {
const message = {handlerName, args, recipient};
message.id = randomID();
message.type = MESSAGE_TYPES.COMMAND;
game.socket.emit(this.socketName, message);
}
@@ -241,7 +240,7 @@ class SocketlibSocket {
[name, func] = this._resolveFunction(handlerName);
}
catch (e) {
if (e instanceof errors.SocketlibUnregisteredHandlerError) {
if (e instanceof errors.SocketlibUnregisteredHandlerError && type === MESSAGE_TYPES.REQUEST) {
this._sendError(id, MESSAGE_TYPES.UNREGISTERED);
}
throw e;
@@ -258,7 +257,6 @@ class SocketlibSocket {
}
catch (e) {
console.error(`An exception occured while executing handler '${name}'.`);
this._sendError(id, MESSAGE_TYPES.EXCEPTION);
throw e;
}
this._sendResult(id, result);