Is there an example of a good logger implementation for socket.io? #4283
Unanswered
Natashkinsasha
asked this question in
Q&A
Replies: 1 comment 1 reply
-
Hi! Do you have a specific API in mind?
Currently, you should be able to log connections, disconnections and incoming packets: io.on("connection", (socket) => {
// log connection
socket.onAny((event, ...args) => {
// log incoming packet
});
socket.on("disconnection", (reason) => {
// log disconnection
});
}); You could also intercept the output of the |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
I have been using socket.io for several years, but still have not found or come up with a way to log all messages, ack, emit, connections and disconnections. At the moment, the best thing I came up with is to log everything that is encoded and decoded in my custom parser. But unfortunately in the encoder and decoder there is no information about the socket on which the messages go. I am increasingly moving away from the REST API in favor of socket.io, but I am very frustrated that there is still no logging tool
Beta Was this translation helpful? Give feedback.
All reactions