Skip to content
This repository has been archived by the owner on Aug 20, 2022. It is now read-only.

Commit

Permalink
Removed any trace of Protocol v2
Browse files Browse the repository at this point in the history
  • Loading branch information
yahiaetman committed Feb 12, 2020
1 parent a91ac9e commit 17d5730
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 12 deletions.
7 changes: 1 addition & 6 deletions src/examples/console-client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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;
Expand Down
7 changes: 1 addition & 6 deletions src/examples/console-silly-agent.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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();

Expand Down Expand Up @@ -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;
Expand Down

0 comments on commit 17d5730

Please sign in to comment.