-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.ts
56 lines (50 loc) · 1.6 KB
/
index.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
import express, {Express} from 'express';
import initFirebase from './src/utils/firebase/init';
import initControllers from './src/controllers';
const initExpress = () : Express => {
const app = express();
app.use(express.json());
app.listen(8080);
return app;
}
const main = () => {
initControllers(initExpress());
initFirebase()
console.log('Server Started');
}
// import WebSocket from 'ws';
// const mainService = new WebSocket.Server({
// port: 8080,
// perMessageDeflate: {
// zlibDeflateOptions: {
// // See zlib defaults.
// chunkSize: 1024,
// memLevel: 7,
// level: 3
// },
// zlibInflateOptions: {
// chunkSize: 10 * 1024
// },
// // Other options settable:
// clientNoContextTakeover: true, // Defaults to negotiated value.
// serverNoContextTakeover: true, // Defaults to negotiated value.
// serverMaxWindowBits: 10, // Defaults to negotiated value.
// // Below options specified as default values.
// concurrencyLimit: 10, // Limits zlib concurrency for perf.
// threshold: 1024 // Size (in bytes) below which messages
// // should not be compressed.
// }
// });
// mainService.on('connection', (ws) => {
// ws.on('message', (message) => {
// console.log('received: %s', message);
// if (message === "oq?") {
// ws.send('tambem não sei...')
// }
// });
// ws.send('something');
// setTimeout(() => {
// ws.send('YEY IT WORKS')
// }, 5000);
// });
main();