on-ping.js 450 Bytes
const MODULE_NAME = 'KOMODO-SDK-PUSH-TRX.ON-PING';

const logger = require('tektrans-logger');

module.exports = (ws, data) => {
    let pingData;
    try {
        pingData = JSON.parse(data.toString());
    } catch (e) {
        pingData = data.toString();
    }

    logger.debug(`${MODULE_NAME} B8D665C7: Got PING`, {
        data: pingData,
    });

    // eslint-disable-next-line no-param-reassign
    ws.isAlive = true;
    ws.pong(data);
};