Created
February 20, 2017 21:03
-
-
Save hartct/193d3efe15c0c847014319b4286be663 to your computer and use it in GitHub Desktop.
Bootstrap the hybrid bot application
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var env = require('node-env-file'); | |
var app = require('express')(); | |
var http = require('http').Server(app); | |
var io = require('socket.io')(http); | |
var redis = require('redis').createClient; | |
var adapter = require('socket.io-redis'); | |
env('.env'); | |
var pub = redis(process.env.redisPort, process.env.redisHost, { auth_pass: process.env.redisPassword }); | |
var sub = redis(process.env.redisPort, process.env.redisHost, { auth_pass: process.env.redisPassword }); | |
io.adapter(adapter({ pubClient: pub, subClient: sub })); | |
// start bot server with IO for socket notifications | |
var botServer = require('./lib/botServer')(io, http); | |
// start socket listener for chat agents | |
var socketManager = require('./lib/socketManager')(io, http); | |
app.get('/', function(req, res){ | |
res.sendFile(__dirname + '/index.html'); | |
}); | |
app.get('/join_chat.html', function(req, res){ | |
res.sendFile(__dirname + '/join_chat.html'); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment