cWS
cWS copied to clipboard
Overriding .onmessage triggers "cWS does not support multiple listeners"
I wanted to handle first message differently then the rest:
const messageHandler = message => {
handleDifferently(message);
ws.onmessage = anotherMessageHandler;
};
ws.onmessage = messageHandler;
cWS does not support multiple listeners for the same event. Old listener for 'message' event will be overwritten
Expected: no warning issued
This is just a warning informing you about switch of the listener unfortunately there is no way to disable that at the moment.
Correct - I understand it's a minor issue. Reporting it nonetheless.