Commit 11abd177 authored by 何硕's avatar 何硕

test wss

parent d6f821eb
var app = require('express')(); var app = require('express')();
var http = require('http').createServer(app); var server = app.listen(3001, function(){
var https = require("https"); console.log('http listening on *:3001');
});
// var http = require('http').createServer(app);
// var https = require("https");
var axios = require('axios'); var axios = require('axios');
var io = require('socket.io').listen(server);
// var io = require('socket.io')(http); // var io = require('socket.io')(http);
let fs = require("fs"); // let fs = require("fs");
// app.all('*', function(req, res, next) { // app.all('*', function(req, res, next) {
...@@ -42,11 +46,8 @@ app.get('/', function(req, res){ ...@@ -42,11 +46,8 @@ app.get('/', function(req, res){
res.send('<h1>Hello world</h1>'); res.send('<h1>Hello world</h1>');
}); });
http.listen(3001, function(){
console.log('http listening on *:3001');
});
var io = require('socket.io').listen(http); // var io = require('socket.io').listen(http);
io.on('connection', function(socket){ io.on('connection', function(socket){
console.log("connection"); console.log("connection");
...@@ -127,6 +128,9 @@ io.on('connection', function(socket){ ...@@ -127,6 +128,9 @@ io.on('connection', function(socket){
}); });
// http.listen(3001, function(){
// console.log('http listening on *:3001');
// });
// https.createServer(httpsOption, app).listen(3000, function(){ // https.createServer(httpsOption, app).listen(3000, function(){
......
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