From 17d5730692188b49a2ce43c3a5cfffaadc508991 Mon Sep 17 00:00:00 2001 From: Yetman Date: Wed, 12 Feb 2020 23:03:15 +0200 Subject: [PATCH] Removed any trace of Protocol v2 --- src/examples/console-client.ts | 7 +------ src/examples/console-silly-agent.ts | 7 +------ 2 files changed, 2 insertions(+), 12 deletions(-) diff --git a/src/examples/console-client.ts b/src/examples/console-client.ts index 4a7edba..5dd2bc0 100644 --- a/src/examples/console-client.ts +++ b/src/examples/console-client.ts @@ -26,7 +26,6 @@ type ClientEvent = const name = process.argv[2] ?? `Client-${process.pid}`; // Get the user name from the command line arguments if defined (default: 'client-' + process-id) const url = process.argv[3] ?? 'ws://localhost:8080'; // Get the websocket url from the command line arguments if defined (default: ws://localhost:8080) -const protocol = process.argv[4] ?? null; // Get the protocol version requested by the client (Note: this is ignored by the client code and is added only for debugging purposes) const game = new GoGame(); // Create a go game to track the game state @@ -182,11 +181,7 @@ function processEvent(event: ClientEvent) { // If this is a server message switch (event.message.type) { case 'NAME': // And the message type is NAME - const protocolFragment = - protocol == null ? {} : { protocol: protocol }; - socket.send( - JSON.stringify({ type: 'NAME', name: name, ...protocolFragment }) - ); // We reply with our name + socket.send(JSON.stringify({ type: 'NAME', name: name })); // We reply with our name state = ClientState.READY; // Then go to ready console.log('Client is ready to play'); break; diff --git a/src/examples/console-silly-agent.ts b/src/examples/console-silly-agent.ts index b1f44d2..1fdbc2d 100644 --- a/src/examples/console-silly-agent.ts +++ b/src/examples/console-silly-agent.ts @@ -33,7 +33,6 @@ if (isMainThread) { const name = process.argv[2] ?? `Client-${process.pid}`; const url = process.argv[3] ?? 'ws://localhost:8080'; - const protocol = process.argv[4] ?? null; const game = new GoGame(); @@ -128,11 +127,7 @@ if (isMainThread) { if (event.type == 'MESSAGE') { switch (event.message.type) { case 'NAME': - const protocolFragment = - protocol == null ? {} : { protocol: protocol }; - socket.send( - JSON.stringify({ type: 'NAME', name: name, ...protocolFragment }) - ); + socket.send(JSON.stringify({ type: 'NAME', name: name })); state = ClientState.READY; console.log('Client is ready to play'); break;