const WebSocket = require('ws') const config = require('../config') const ws = new WebSocket(`wss://${config.twitch.chat_host}:443`, 'irc') ws.on('open', () => { }) ws.on('message', (data) => { if (typeof data !== 'string') data = data.toString() }) ws.on('error', (err) => { console.error(err) }) ws.on('close', (code, reason) => { console.log('exit', code, reason) }) module.exports = ws