@hytopia.com/server-protocol 1.0.54 → 1.0.57

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hytopia.com/server-protocol",
3
- "version": "1.0.54",
3
+ "version": "1.0.57",
4
4
  "main": "index.js",
5
5
  "scripts": {
6
6
  "test": "echo \"Error: no test specified\" && exit 1"
@@ -5,7 +5,6 @@ import type { VectorSchema } from './Vector';
5
5
  export type SimulationSchema = {
6
6
  wi: number; // world id
7
7
  t?: number; // timestep (seconds)
8
- r?: number; // tick rate (ticks per second)
9
8
  g?: VectorSchema; // gravity
10
9
  };
11
10
 
@@ -14,7 +13,6 @@ export const simulationSchema: JSONSchemaType<SimulationSchema> = {
14
13
  properties: {
15
14
  wi: { type: 'number' },
16
15
  t: { type: 'number', nullable: true },
17
- r: { type: 'number', nullable: true },
18
16
  g: { ...vectorSchema, nullable: true },
19
17
  },
20
18
  required: [ 'wi' ],
@@ -1,6 +1,8 @@
1
1
  import type { JSONSchemaType } from 'ajv';
2
2
 
3
3
  export type SyncResponseSchema = {
4
+ r: number; // server absolute time at sync request as Date.now()
5
+ s: number; // server absolute time at sync response as Date.now()
4
6
  p: number; // high resolution ms of total processing time from request receipt to response
5
7
  n: number; // high resolution ms at server response time until next server tick
6
8
  };
@@ -8,9 +10,11 @@ export type SyncResponseSchema = {
8
10
  export const syncResponseSchema: JSONSchemaType<SyncResponseSchema> = {
9
11
  type: 'object',
10
12
  properties: {
13
+ r: { type: 'number' },
14
+ s: { type: 'number' },
11
15
  p: { type: 'number' },
12
16
  n: { type: 'number' },
13
17
  },
14
- required: [ 'p', 'n' ],
18
+ required: [ 'r', 's', 'p', 'n' ],
15
19
  additionalProperties: false,
16
20
  }