lib/event-provider/index.js
function subscribeToEvents() {
    const socket = _socket.get(this);

    function onEventApiError(error) {
        dbg('Event API connection error: ' + JSON.stringify(error));
    }

    socket.on('pong', (latency) => {
        dbg(`Event API latency: ${latency} ms`);
    });
    socket.on('connect_error', onEventApiError);
    socket.on('error', onEventApiError);
    socket.on('disconnect', onEventApiError);
    socket.on('reconnect_error', onEventApiError);
    socket.on('reconnect_failed', () => {
        onEventApiError('Reconnecting to the Event API failed');
    });

    socket.on('new_receipt', receiptJSON => {
        const receipt = Receipt.from(receiptJSON, _provider.get(this));
        _eventEmitter.get(this).emit(EventNames.newReceipt, receipt);
    });
}
function subscribeToEvents() {
    const socket = _socket.get(this);

    function onEventApiError(error) {
        dbg('Event API connection error: ' + JSON.stringify(error));
    }

    socket.on('pong', (latency) => {
        dbg(`Event API latency: ${latency} ms`);
    });
    socket.on('connect_error', onEventApiError);
    socket.on('error', onEventApiError);
    socket.on('disconnect', onEventApiError);
    socket.on('reconnect_error', onEventApiError);
    socket.on('reconnect_failed', () => {
        onEventApiError('Reconnecting to the Event API failed');
    });

    socket.on('new_receipt', receiptJSON => {
        const receipt = Receipt.from(receiptJSON, _provider.get(this));
        _eventEmitter.get(this).emit(EventNames.newReceipt, receipt);
    });
}
function subscribeToEvents ( ) { const socket = _socket . get ( this ) ; function onEventApiError ( error ) { dbg ( 'Event API connection error: ' + JSON . stringify ( error ) ) ; } socket . on ( 'pong' , ( latency ) => { dbg ( ` ${ latency } ` ) ; } ) ; socket . on ( 'connect_error' , onEventApiError ) ; socket . on ( 'error' , onEventApiError ) ; socket . on ( 'disconnect' , onEventApiError ) ; socket . on ( 'reconnect_error' , onEventApiError ) ; socket . on ( 'reconnect_failed' , ( ) => { onEventApiError ( 'Reconnecting to the Event API failed' ) ; } ) ; socket . on ( 'new_receipt' , receiptJSON => { const receipt = Receipt . from ( receiptJSON , _provider . get ( this ) ) ; _eventEmitter . get ( this ) . emit ( EventNames . newReceipt , receipt ) ; } ) ; }
Subscribes to critical socket.io events and relays nahmii events to any
registered listeners.
Private method, invoke with 'this' bound to provider instance.
@private
Subscribes to critical socket . io events and relays nahmii events to any registered listeners . Private method invoke with this bound to provider instance .