2021-11-05 00:30:30 +00:00
|
|
|
import * as https from 'https';
|
|
|
|
import * as path from 'path';
|
|
|
|
|
|
|
|
import * as fs from 'fs';
|
|
|
|
import * as socketio from 'socket.io';
|
|
|
|
|
|
|
|
const server = https.createServer({
|
|
|
|
cert: fs.readFileSync(path.join(__dirname, '../../server-test/ssl/cert.pem')).toString(),
|
2022-02-09 00:05:45 +00:00
|
|
|
key: fs.readFileSync(path.join(__dirname, '../../server-test/ssl/key.pem')).toString(),
|
2021-11-05 00:30:30 +00:00
|
|
|
});
|
|
|
|
|
|
|
|
const io = new socketio.Server(server);
|
|
|
|
|
|
|
|
io.on('connection', (socket: socketio.Socket) => {
|
|
|
|
socket.on('hello', (message: string) => {
|
|
|
|
console.log('got a hello :)');
|
|
|
|
socket.emit('exde');
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
server.listen(4040);
|
|
|
|
console.log('listening on 4040');
|