twitch-bot/libs/botClient.js

24 lines
406 B
JavaScript
Raw Normal View History

2018-02-12 15:08:42 +00:00
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