@hytopia.com/server-protocol 1.0.35 → 1.0.37

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.35",
3
+ "version": "1.0.37",
4
4
  "main": "index.js",
5
5
  "scripts": {
6
6
  "test": "echo \"Error: no test specified\" && exit 1"
@@ -1,8 +1,14 @@
1
1
  import type { JSONSchemaType } from 'ajv';
2
2
 
3
- export type SyncRequestSchema = null;
3
+ export type SyncRequestSchema = {
4
+ s: number; // client request send as Date.now()
5
+ };
4
6
 
5
7
  export const syncRequestSchema: JSONSchemaType<SyncRequestSchema> = {
6
- type: 'null',
7
- nullable: true,
8
+ type: 'object',
9
+ properties: {
10
+ s: { type: 'number' },
11
+ },
12
+ required: [ 's' ],
13
+ additionalProperties: false,
8
14
  }
@@ -1,16 +1,18 @@
1
1
  import type { JSONSchemaType } from 'ajv';
2
2
 
3
3
  export type SyncResponseSchema = {
4
- s: number; // server time
5
- nt: number; // time until next server tick, relative to server time
4
+ r: number; // server request receipt time as Date.now()
5
+ s: number; // server response time as Date.now()
6
+ t: number; // server time till next tick in ms from server response time
6
7
  };
7
8
 
8
9
  export const syncResponseSchema: JSONSchemaType<SyncResponseSchema> = {
9
10
  type: 'object',
10
11
  properties: {
12
+ r: { type: 'number' },
11
13
  s: { type: 'number' },
12
- nt: { type: 'number' },
14
+ t: { type: 'number' },
13
15
  },
14
- required: [ 's', 'nt' ],
16
+ required: [ 'r', 's', 't' ],
15
17
  additionalProperties: false,
16
18
  }