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

Can't assign more than one handler to connection events #1933

Closed
melnikaite opened this issue Sep 11, 2018 · 2 comments
Closed

Can't assign more than one handler to connection events #1933

melnikaite opened this issue Sep 11, 2018 · 2 comments
Labels
Enhancement Includes improvements or optimizations

Comments

@melnikaite
Copy link

I'd like to catch end event in one place and do reconnect and resubscribe to .allEvents in another place, but I can't assign more than function to connect end and error events of websocket provider. Here is part of code explaining why it happens

WebsocketProvider.prototype.on = function (type, callback) {

    if(typeof callback !== 'function')
        throw new Error('The second parameter callback must be a function.');

    switch(type){
        case 'data':
            this.notificationCallbacks.push(callback);
            break;

        case 'connect':
            this.connection.onopen = callback;
            break;

        case 'end':
            this.connection.onclose = callback;
            break;

        case 'error':
            this.connection.onerror = callback;
            break;
    }
@nivida nivida added the In Progress Currently being worked on label Nov 28, 2018
@nivida nivida added Enhancement Includes improvements or optimizations and removed In Progress Currently being worked on labels Mar 7, 2019
@nivida
Copy link
Contributor

nivida commented Mar 7, 2019

This got implemented in beta.38.

@nivida nivida closed this as completed Mar 7, 2019
@tsujp
Copy link

tsujp commented Jul 18, 2019

This does not work beta.55, the method is now close.

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

No branches or pull requests

3 participants