Skip to content

Commit 4265884

Browse files
Further commenting and breakdown
1 parent edfda3d commit 4265884

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

Server/Index.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,11 @@ app.get('/', (req: Request, res: Response) => {``
1111
res.send({ message: 'Server is active', timestamp: new Date() });
1212
});
1313

14+
/** Broker listen to all subscribers and manage protocol */
1415
io.on('connection', (socket: any) => {
15-
console.log(socket)
1616
console.log('a user connected');
17+
socket.emit(' new user joined ')
18+
1719
/** User subscribe and publish protocol */
1820
socket.on("user:subscribe", (resp: any) => {
1921
socket.join("subscribers");
@@ -36,6 +38,7 @@ io.on('connection', (socket: any) => {
3638

3739
});
3840

41+
/** Launch server and listen on given port */
3942
try {
4043
server.listen(port, (): void => {
4144
console.log(`Server is active at http://localhost:${port}`);

0 commit comments

Comments
 (0)