desc time author veaba
 *  const express = require ( 'express' ) ; const app = express ( ) ; const http = require ( 'http' ) . Server ( app ) ; const io = require ( 'socket.io' ) ( http ) ; const bodyParser = require ( 'body-parser' ) ; app . use ( bodyParser . urlencoded ( { extended : true } ) ) ; app . use ( bodyParser . json ( ) ) ; import { tencent } from "./utils/task" ; import { connectMongo } from './mongo/mongo' ; import { connectSocket , onSocket } from "./sockets/socket" ; import { router } from './routers/router' ; import { getBarrageList } from "./sockets/talk" ; import { delKey } from "./redis/redis" ; app . use ( router ) ; app . get ( '/' , ( req , res ) => { res . send ( '干嘛？' ) ; } ) ; const broadcastChannel = io . of ( '/broadcast' ) . on ( 'connection' , async ( socket ) => { connectSocket ( socket ) . then ( ) ; onSocket ( socket , 'talk' ) . then ( ) ; onSocket ( socket , 'getTotal' ) . then ( ) ; onSocket ( socket , 'getChinaDay' ) . then ( ) ; onSocket ( socket , 'getChinaRank' ) . then ( ) ; onSocket ( socket , 'getWorldRank' ) . then ( ) ; onSocket ( socket , 'getWorldMap' ) . then ( ) ; getBarrageList ( io , socket , 'getTalk' ) . then ( ) ; } ) ; setInterval ( async ( ) => { await tencent ( ) ; } , 60 * 1000 ) ; desc const _pushSuccess = async ( channel , eventName , data , msg ? , code ? ) => { if ( ! channel . includes ( '/' ) ) { channel = '/' + channel ; } return await io . of ( channel ) . emit ( eventName , { code : code , data , msg : msg || 'success' } ) ; } ; desc const _pushError = async ( channel , eventName , data , msg ? , code ? ) => { return io . of ( channel ) . emit ( eventName , { code : 1 , data , msg : msg || 'error' } ) ; } ; desc const _pushPrivate = async ( channel , eventName , id , data , msg ? , code ? ) => { if ( ! channel . includes ( '/' ) ) { channel = '/' + channel ; } return await io . of ( channel ) . to ( id ) . emit ( eventName , { data , msg : msg || "success" , code : code } ) ; } ; http . listen ( 9999 , async ( ) => { await connectMongo ( ) ; await delKey ( "onlineSocket" ) ; console . info ( ' >     Biubiu 走您~ 9999 √' ) ; } ) ; export { broadcastChannel , _pushError , _pushSuccess , _pushPrivate } ;