aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSimon Ser <contact@emersion.fr>2024-03-01 15:03:09 +0100
committerSimon Ser <contact@emersion.fr>2024-03-01 15:03:09 +0100
commit429b4595e7a8f37920f933944297c1a6fd0e5a38 (patch)
tree0efabbb1f51a0c9ddec9f463dbeb8705f6092a6e
parent038cc68ee436bb3038dc672381af46bdba13c824 (diff)
downloadgamja-429b4595e7a8f37920f933944297c1a6fd0e5a38.tar.gz
gamja-429b4595e7a8f37920f933944297c1a6fd0e5a38.zip
lib/client: print raw messages in debug mode
Browser consoles aren't super helpful in general and just show the command name, require extra clicks to see the params.
-rw-r--r--lib/client.js11
1 files changed, 7 insertions, 4 deletions
diff --git a/lib/client.js b/lib/client.js
index a1a969a..36c1e79 100644
--- a/lib/client.js
+++ b/lib/client.js
@@ -287,11 +287,13 @@ export default class Client extends EventTarget {
return;
}
- let msg = irc.parseMessage(event.data);
+ let raw = event.data;
if (this.debug) {
- console.debug("Received:", msg);
+ console.debug("Received:", raw);
}
+ let msg = irc.parseMessage(raw);
+
// If the prefix is missing, assume it's coming from the server on the
// other end of the connection
if (!msg.prefix) {
@@ -708,9 +710,10 @@ export default class Client extends EventTarget {
if (!this.ws) {
throw new Error("Failed to send IRC message " + msg.command + ": socket is closed");
}
- this.ws.send(irc.formatMessage(msg));
+ let raw = irc.formatMessage(msg)
+ this.ws.send(raw);
if (this.debug) {
- console.debug("Sent:", msg);
+ console.debug("Sent:", raw);
}
}