Skip to content

Commit

Permalink
Log changes easier to read and more compact
Browse files Browse the repository at this point in the history
  • Loading branch information
sentivate committed Apr 1, 2021
1 parent dfb97ad commit 0ce7adb
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 8 deletions.
5 changes: 3 additions & 2 deletions server/api/onMessage/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,8 @@ module.exports = (server) => {
if (method) {
if (body) {
if (hasValue(sid)) {
cnsl(`Request:${api} RequestID: ${sid}`, message.body);
cnsl(`Request:${api} RequestID: ${sid}`);
console.log(message.body);
const response = {
sid
};
Expand All @@ -37,7 +38,7 @@ module.exports = (server) => {
const eid = message.eid;
if (hasValue(eid)) {
success(`Request:${method} Emit ID:${eid} ${stringify(message)}`);
method(socket, body, message);
return method(socket, body, message);
} else {
return logError(`Invalid Request type. No Emit ID was given. ${stringify(message)}`);
}
Expand Down
13 changes: 7 additions & 6 deletions server/send/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ module.exports = (server) => {
sid
} = rawMessage;
success(`PROCESSING MESSAGE TO SEND`);
console.log(options);
console.log(rawMessage);
console.log('Packet Options', options);
console.log('Raw Message', rawMessage);
success(`clientId: ${id.toString('base64')}`);
success(`Transmit Key ${toBase64(transmitKey)}`);
let size = 0;
Expand Down Expand Up @@ -58,13 +58,14 @@ module.exports = (server) => {
size = size + bodyLength;
success('BODY PAYLOAD', bodyLength);
}
if (size > 1000) {
console.log('Send item is too large will need to break down.');
}
if (sid) {
client.sendQueue.set(sid, sendObject);
}
return sendRaw(rawMessage, address, port, nonce, transmitKey, id);
if (size > 1000) {
console.log('Send item is too large will need to chunk into packets.');
} else {
return sendRaw(rawMessage, address, port, nonce, transmitKey, id);
}
}
server.send = send;
};

0 comments on commit 0ce7adb

Please sign in to comment.