5f7c2ccec25ec5060daf2690f501b8018925cd48
[motion2.git] / server / services / express / index.js
1 // *************************************************************************
2 // *                                                                       *
3 // * xCALLY Motion -  The Omnichannel Contact Center                       *
4 // * Copyright (c) Xenialab s.r.l. All Rights Reserved                     *
5 // *                                                                       *
6 // *************************************************************************
7 // *                                                                       *
8 // * Email: info@xcally.com                                                *
9 // * Website: https://www.xcally.com                                       *
10 // *                                                                       *
11 // *************************************************************************
12 // *                                                                       *
13 // * The SOFTWARE PRODUCT is protected by copyright laws and international *
14 // * copyright treaties, as well as other intellectual property laws and   *
15 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                         *
16 // *                                                                       *
17 // *************************************************************************
18 var _0x5b98=['../../config/socketio','once','listening','log','Express\x20server\x20listening\x20on\x20port\x20%d!','exports','http','sticky-session','../../config/environment','createServer','listen','websocket','redis','defaults','localhost','adapter','../../config/triggers','default'];(function(_0x4f7a8c,_0x122773){var _0x41a993=function(_0x2361c0){while(--_0x2361c0){_0x4f7a8c['push'](_0x4f7a8c['shift']());}};_0x41a993(++_0x122773);}(_0x5b98,0x1ec));var _0x85b9=function(_0x3b0731,_0xcf9925){_0x3b0731=_0x3b0731-0x0;var _0x4204d7=_0x5b98[_0x3b0731];return _0x4204d7;};'use strict';var _=require('lodash');var http=require(_0x85b9('0x0'));var express=require('express');var sticky=require(_0x85b9('0x1'));var Redis=require('ioredis');var config=require(_0x85b9('0x2'));var app=express();var server=http[_0x85b9('0x3')](app);server['timeout']=0xdbba0;if(sticky[_0x85b9('0x4')](server,config['port'])){var socketio=require('socket.io')(server,{'transports':[_0x85b9('0x5'),'polling']});config[_0x85b9('0x6')]=_[_0x85b9('0x7')](config[_0x85b9('0x6')],{'host':_0x85b9('0x8'),'port':0x18eb});socketio[_0x85b9('0x9')](require('socket.io-redis')({'pubClient':new Redis(config[_0x85b9('0x6')]),'subClient':new Redis(config[_0x85b9('0x6')])}));require(_0x85b9('0xa'))[_0x85b9('0xb')]();require(_0x85b9('0xc'))[_0x85b9('0xb')](socketio);require('../../config/express')[_0x85b9('0xb')](app);require('../../routes')[_0x85b9('0xb')](app);}else{server[_0x85b9('0xd')](_0x85b9('0xe'),function(){console[_0x85b9('0xf')](_0x85b9('0x10'),config['port']);});}exports=module[_0x85b9('0x11')]=app;