Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to detach/remove callback from socket ? #118

Open
jayendra13 opened this issue Jun 19, 2017 · 1 comment
Open

How to detach/remove callback from socket ? #118

jayendra13 opened this issue Jun 19, 2017 · 1 comment

Comments

@jayendra13
Copy link

The documentation doesn't suggest any way to remove callback from socket. We can access the raw websocket object from property and call removeEventListener method of it, but that is not working for me.

var stream = $websocket("ws://localhost:7070/ws");

stream.socket.removeEventListener('message', callback);

Can anyone help me here ?

@theodesp
Copy link

theodesp commented Aug 3, 2017

You can't do that for now as you don't have access to the original callback as you can see here
https://github.com/AngularClass/angular-websocket/blob/master/src/angular-websocket.js#L122-L129

The callbacks are part of the internal library and it's not wise to reference them

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

No branches or pull requests

2 participants