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

.disconnect causes errors in console #745

Open
stiv-yakovenko opened this issue Sep 29, 2018 · 2 comments
Open

.disconnect causes errors in console #745

stiv-yakovenko opened this issue Sep 29, 2018 · 2 comments

Comments

@stiv-yakovenko
Copy link

If I call .disconnect, then this code is executed:

SimpleWebRTC.prototype.disconnect = function () {
    if (this.connection) {
        this.connection.disconnect();
        delete this.connection;
    }
};

so later it will crash here:

this.webrtc.on('message', function (payload) {
        self.connection.emit('message', payload);
    });

since self.connection is undefined.

@dcotoz
Copy link

dcotoz commented Oct 1, 2018

I guess you can check if the connection is still active before calling emit

@stiv-yakovenko
Copy link
Author

it is not me calling self.connection.emit, this is webrtc calling it:

this.webrtc.on('message', function (payload) {
self.connection.emit('message', payload);
});

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