Skip to content
This repository has been archived by the owner on Nov 2, 2020. It is now read-only.

Overriding .onmessage triggers "cWS does not support multiple listeners" #46

Open
Rush opened this issue Aug 1, 2020 · 2 comments
Open

Comments

@Rush
Copy link

Rush commented Aug 1, 2020

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

@goriunov
Copy link
Member

goriunov commented Aug 2, 2020

This is just a warning informing you about switch of the listener unfortunately there is no way to disable that at the moment.

@Rush
Copy link
Author

Rush commented Aug 2, 2020

Correct - I understand it's a minor issue. Reporting it nonetheless.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants