'use strict'; const socketIO = require("socket.io-client"); let client = socketIO.connect("http://ws.listentotwitter.com"); function heartbeat() { client.emit('ping', {keyword: process.argv[2]}); } client.on("tweet", (data) => { console.log(JSON.stringify(data)); }); client.on("connect", () => { heartbeat(); setInterval(heartbeat, 3000); });