apollographql / subscriptions-transport-ws

:arrows_clockwise: A WebSocket client + server for GraphQL subscriptions
https://www.npmjs.com/package/subscriptions-transport-ws
MIT License
1.52k stars 342 forks source link

onConnected and onReconnected event do not fire #880

Closed keithhackbarth closed 2 years ago

keithhackbarth commented 3 years ago

In our React code, we see logging for onConnecting, onReconnecting and onDisconnected events but not onConnected and onReconnected

It appears that a few people have complained about this issue in various Stackoverflow threads but have not seen it listed here.

subscription-transport-ws: 0.9.19 python graphene blackened

client code

export const addListeners = (subscriptionClient, onConnect, onDisconnect) => {

    subscriptionClient.onConnecting(() => {
        Log.info('connecting to websocket...');
    });

    subscriptionClient.onConnected(() => {
        Log.info('connected to websocket!');
    });

    subscriptionClient.onReconnecting(() => {
        Log.info('reconnecting to websocket...');
    });

    subscriptionClient.onReconnected(() => {
        Log.info('reconnected to websocket');
    });

    subscriptionClient.onDisconnected(() => {
        Log.warn('disconnected from websocket');
    });
};
Cerberus commented 3 years ago

Normally, onConnected & onReconnected will be fired after the server acknowledges with { type: 'connection_ack' }

@keithhackbarth Could you please confirm on dev-tools ? It should display like this.

ss