Commit 38797197 authored by 何硕's avatar 何硕

正式socket配置

parent d874874b
var express = require('express');
var app = express();
// app.use('/wss', express.static(__dirname ));
var http = require('http').createServer(app);
// var https = require("https");
var axios = require('axios');
var io = require('socket.io')(http);
// let fs = require("fs");
// app.all('*', function(req, res, next) {
// res.header("Access-Control-Allow-Origin", "*");
// res.header("Access-Control-Allow-Headers", "Content-Type,Content-Length, Authorization, Accept,X-Requested-With");
// res.header("Access-Control-Allow-Methods","PUT,POST,GET,DELETE,OPTIONS");
// res.header("X-Powered-By",' 3.2.1');
// res.header("Content-Type", "application/json;charset=utf-8");
// next();
// });
// var BaseUrl = "http://localhost/api/";
var BaseUrl = "https://zhibo.xueyoubangedu.com/api/";
// var BaseUrl = "https://live.xueyoubangedu.com/api/";
// const httpsOption = {
// key : fs.readFileSync("./https/privkey.pem"),
// cert: fs.readFileSync("./https/fullchain.pem")
// }
// const httpsOption = {
// key : fs.readFileSync("./https/zhibo.xueyoubangedu.com.key"),
// cert: fs.readFileSync("./https/zhibo.xueyoubangedu.com.pem")
// }
app.get('/', function(req, res){
res.send('<h1>Hello world</h1>');
});
......@@ -117,9 +94,4 @@ io.on('connection', function(socket){
http.listen(3001, function(){
console.log('http listening on *:3001');
});
// https.createServer(httpsOption, app).listen(3000, function(){
// console.log('https listening on *:3000');
// });
\ No newline at end of file
});
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment