You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
23 lines
448 B
23 lines
448 B
4 years ago
|
var path = require('path');
|
||
|
var app = require('express')();
|
||
|
var http = require('http').Server(app);
|
||
|
var io = require('socket.io')(http);
|
||
|
|
||
|
|
||
|
|
||
|
const cors = require('cors')
|
||
|
app.use(cors());
|
||
|
|
||
|
io.on('connection', s => {
|
||
|
console.error('socket connection');
|
||
|
|
||
|
io.on('data', function(s) {
|
||
|
console.log('Got', s);
|
||
|
})
|
||
|
|
||
|
});
|
||
|
|
||
|
|
||
|
http.listen(5000, () => console.error('listening on http://localhost:5000/'));
|
||
|
console.error('socket.io example');
|