Don't send a package id for commands as it's not needed
This commit is contained in:
@@ -1,6 +1,7 @@
|
|||||||
## In development
|
## In development
|
||||||
### New features
|
### New features
|
||||||
- The `this` value of functions now contains the id of the user that triggered the function execution.
|
- The `this` value of functions now contains the id of the user that triggered the function execution.
|
||||||
|
- Some network packets are now more efficient.
|
||||||
|
|
||||||
### Bugfixes
|
### Bugfixes
|
||||||
- When an invalid user id is specified socketlib will now throw the correct error message.
|
- When an invalid user id is specified socketlib will now throw the correct error message.
|
||||||
|
|||||||
@@ -168,7 +168,6 @@ class SocketlibSocket {
|
|||||||
|
|
||||||
_sendCommand(handlerName, args, recipient) {
|
_sendCommand(handlerName, args, recipient) {
|
||||||
const message = {handlerName, args, recipient};
|
const message = {handlerName, args, recipient};
|
||||||
message.id = randomID();
|
|
||||||
message.type = MESSAGE_TYPES.COMMAND;
|
message.type = MESSAGE_TYPES.COMMAND;
|
||||||
game.socket.emit(this.socketName, message);
|
game.socket.emit(this.socketName, message);
|
||||||
}
|
}
|
||||||
@@ -241,7 +240,7 @@ class SocketlibSocket {
|
|||||||
[name, func] = this._resolveFunction(handlerName);
|
[name, func] = this._resolveFunction(handlerName);
|
||||||
}
|
}
|
||||||
catch (e) {
|
catch (e) {
|
||||||
if (e instanceof errors.SocketlibUnregisteredHandlerError) {
|
if (e instanceof errors.SocketlibUnregisteredHandlerError && type === MESSAGE_TYPES.REQUEST) {
|
||||||
this._sendError(id, MESSAGE_TYPES.UNREGISTERED);
|
this._sendError(id, MESSAGE_TYPES.UNREGISTERED);
|
||||||
}
|
}
|
||||||
throw e;
|
throw e;
|
||||||
@@ -258,7 +257,6 @@ class SocketlibSocket {
|
|||||||
}
|
}
|
||||||
catch (e) {
|
catch (e) {
|
||||||
console.error(`An exception occured while executing handler '${name}'.`);
|
console.error(`An exception occured while executing handler '${name}'.`);
|
||||||
this._sendError(id, MESSAGE_TYPES.EXCEPTION);
|
|
||||||
throw e;
|
throw e;
|
||||||
}
|
}
|
||||||
this._sendResult(id, result);
|
this._sendResult(id, result);
|
||||||
|
|||||||
Reference in New Issue
Block a user