This repository has been archived by the owner on Jun 10, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 61
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Improvements to client join process (#155)
* Debug in the terminal. network logging overwhelms the internal console. * Sort the functional test menu. * Remove position and rotation fields from rigid body. * Lots of improvements to client join process. * rollback server.ts * rebase on red and resolve conflicts
- Loading branch information
1 parent
993d484
commit edf03dc
Showing
22 changed files
with
394 additions
and
399 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
29 changes: 29 additions & 0 deletions
29
packages/sdk/src/adapters/multipeer/protocols/clientStartup.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
/*! | ||
* Copyright (c) Microsoft Corporation. All rights reserved. | ||
* Licensed under the MIT License. | ||
*/ | ||
|
||
import { Client } from '..'; | ||
import * as Protocols from '../../../protocols'; | ||
import * as Payloads from '../../../types/network/payloads'; | ||
|
||
export class ClientStartup extends Protocols.Protocol { | ||
/** @override */ | ||
public get name(): string { return `${this.constructor.name} client ${this.client.id}`; } | ||
|
||
constructor(private client: Client) { | ||
super(client.conn); | ||
// Behave like a server-side endpoint (send heartbeats, measure connection quality). | ||
this.use(new Protocols.ServerPreprocessing()); | ||
} | ||
|
||
/** | ||
* @hidden | ||
*/ | ||
public 'recv-sync-request' = async (payload: Payloads.SyncRequest) => { | ||
// Do a quick measurement of connection latency. | ||
const heartbeat = new Protocols.Heartbeat(this); | ||
await heartbeat.runIterations(10); // Allow exceptions to propagate out. | ||
this.resolve(); | ||
} | ||
} |
Oops, something went wrong.