Skip to content

Commit 1958df6

Browse files
Expand Dynamic Handler: Listen to updates about current Router from Switcher
1 parent 0e41374 commit 1958df6

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

Server/src/Router.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ Router.on('message', (msg, senderInfo) => {
3333
// Type 0: Message from Server - accepted this as new Router on network
3434
// Type 4: Message from Server - received information about a Client
3535
// Type 5: Message from Client - received message instructions from Client to send message over the network
36+
// Type 6: Message from Server - received updated information about this current Router
3637

3738
const { address, port } = senderInfo;
3839
let { type, message: receivedMessage } = JSON.parse(msg.toString());
@@ -56,6 +57,11 @@ Router.on('message', (msg, senderInfo) => {
5657
// Request information about Clients from Switcher
5758
connectToSwitcher();
5859
break;
60+
case 6:
61+
// Type 6: Message from Switcher - updated information about this Router received
62+
currentRouter = { ...currentRouter, ...receivedMessage };
63+
break;
64+
5965
default:
6066
console.log("Unknown Message Type received");
6167
break;

0 commit comments

Comments
 (0)