Simplify socket.io server configuration

This commit is contained in:
Anthony Wang 2022-01-13 12:21:07 -06:00
parent 26203d9f54
commit 547a46697a
Signed by: a
GPG key ID: BC96B00AEC5F2D76

View file

@ -3,15 +3,4 @@ import http from 'http';
import https from 'https';
import {Server} from 'socket.io';
export default new Server(Number(process.env.PORT!), {cors: {origin: process.env.ORIGIN, methods: ['GET', 'POST']}});
/*const base = process.env.SSL_KEY && process.env.SSL_CERT && process.env.SSL_CA ? https.createServer({
"key": fs.readFileSync(process.env.SSL_KEY),
"cert": fs.readFileSync(process.env.SSL_CERT),
"ca": fs.readFileSync(process.env.SSL_CA)
}) : http.createServer();
base.listen(+process.env.PORT!, '0.0.0.0', () => {
console.log(`Listening on port ${process.env.PORT}`);
});
export default new Server(base, {cors: {origin: process.env.ORIGIN, methods: ['GET', 'POST']}});*/
export default new Server(Number(process.env.PORT!), {cors: {origin: '*', methods: ['GET', 'POST']}});