@esengine/server 4.4.0 → 4.5.1
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/dist/{Room-BnKpl5Sj.d.ts → Room-5owFVIFR.d.ts} +18 -0
- package/dist/auth/index.d.ts +4 -4
- package/dist/auth/testing/index.d.ts +2 -2
- package/dist/chunk-NWZLKNGV.js +2045 -0
- package/dist/chunk-NWZLKNGV.js.map +1 -0
- package/dist/{chunk-FACTBKJ3.js → chunk-T3QJOPNG.js} +37 -2
- package/dist/chunk-T3QJOPNG.js.map +1 -0
- package/dist/chunk-ZUTL4RI7.js +285 -0
- package/dist/chunk-ZUTL4RI7.js.map +1 -0
- package/dist/ecs/index.d.ts +31 -4
- package/dist/ecs/index.js +3 -280
- package/dist/ecs/index.js.map +1 -1
- package/dist/index-B1sr5YAl.d.ts +1076 -0
- package/dist/index.d.ts +1453 -7
- package/dist/index.js +1502 -4
- package/dist/index.js.map +1 -1
- package/dist/ratelimit/index.d.ts +1 -1
- package/dist/testing/index.d.ts +2 -2
- package/dist/testing/index.js +2 -2
- package/dist/{types-C7sS8Sfi.d.ts → types-BCTRacMF.d.ts} +2 -2
- package/package.json +2 -2
- package/dist/chunk-FACTBKJ3.js.map +0 -1
- package/dist/chunk-M7VONMZJ.js +0 -938
- package/dist/chunk-M7VONMZJ.js.map +0 -1
- package/dist/decorators-DY8nZ8Nh.d.ts +0 -26
- package/dist/index-lcuKuQsL.d.ts +0 -470
|
@@ -14,6 +14,7 @@ interface IPlayer<TData = Record<string, unknown>> {
|
|
|
14
14
|
readonly roomId: string;
|
|
15
15
|
data: TData;
|
|
16
16
|
send<T>(type: string, data: T): void;
|
|
17
|
+
sendBinary(data: Uint8Array): void;
|
|
17
18
|
leave(reason?: string): void;
|
|
18
19
|
}
|
|
19
20
|
/**
|
|
@@ -26,12 +27,14 @@ declare class Player<TData = Record<string, unknown>> implements IPlayer<TData>
|
|
|
26
27
|
data: TData;
|
|
27
28
|
private _conn;
|
|
28
29
|
private _sendFn;
|
|
30
|
+
private _sendBinaryFn?;
|
|
29
31
|
private _leaveFn;
|
|
30
32
|
constructor(options: {
|
|
31
33
|
id: string;
|
|
32
34
|
roomId: string;
|
|
33
35
|
conn: Connection<any>;
|
|
34
36
|
sendFn: (conn: Connection<any>, type: string, data: unknown) => void;
|
|
37
|
+
sendBinaryFn?: (conn: Connection<any>, data: Uint8Array) => void;
|
|
35
38
|
leaveFn: (player: Player<TData>, reason?: string) => void;
|
|
36
39
|
initialData?: TData;
|
|
37
40
|
});
|
|
@@ -45,6 +48,19 @@ declare class Player<TData = Record<string, unknown>> implements IPlayer<TData>
|
|
|
45
48
|
* @en Send message to player
|
|
46
49
|
*/
|
|
47
50
|
send<T>(type: string, data: T): void;
|
|
51
|
+
/**
|
|
52
|
+
* @zh 发送二进制数据给玩家
|
|
53
|
+
* @en Send binary data to player
|
|
54
|
+
*
|
|
55
|
+
* @zh 如果底层连接支持原生二进制帧,则直接发送;否则降级为 base64 编码通过 JSON 发送
|
|
56
|
+
* @en If underlying connection supports native binary frames, sends directly; otherwise falls back to base64 encoding via JSON
|
|
57
|
+
*/
|
|
58
|
+
sendBinary(data: Uint8Array): void;
|
|
59
|
+
/**
|
|
60
|
+
* @zh 将 Uint8Array 转换为 base64 字符串
|
|
61
|
+
* @en Convert Uint8Array to base64 string
|
|
62
|
+
*/
|
|
63
|
+
private _toBase64;
|
|
48
64
|
/**
|
|
49
65
|
* @zh 让玩家离开房间
|
|
50
66
|
* @en Make player leave the room
|
|
@@ -114,6 +130,7 @@ declare abstract class Room<TState = any, TPlayerData = Record<string, unknown>>
|
|
|
114
130
|
private _lastTickTime;
|
|
115
131
|
private _broadcastFn;
|
|
116
132
|
private _sendFn;
|
|
133
|
+
private _sendBinaryFn;
|
|
117
134
|
private _disposeFn;
|
|
118
135
|
/**
|
|
119
136
|
* @zh 房间 ID
|
|
@@ -211,6 +228,7 @@ declare abstract class Room<TState = any, TPlayerData = Record<string, unknown>>
|
|
|
211
228
|
_init(options: {
|
|
212
229
|
id: string;
|
|
213
230
|
sendFn: (conn: any, type: string, data: unknown) => void;
|
|
231
|
+
sendBinaryFn?: (conn: any, data: Uint8Array) => void;
|
|
214
232
|
broadcastFn: (type: string, data: unknown) => void;
|
|
215
233
|
disposeFn: () => void;
|
|
216
234
|
}): void;
|
package/dist/auth/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export { i as AuthApiContext, h as AuthConnection, g as AuthConnectionData, f as AuthErrorCode, j as AuthMsgContext, C as ConnectionRequest } from '../types-
|
|
3
|
-
import { G as GameServer,
|
|
4
|
-
import { R as Room, P as Player } from '../Room-
|
|
1
|
+
import { a as IAuthContext, A as AuthResult, I as IAuthProvider, b as AuthServerConfig, c as AuthGameServer, d as AuthRoomConfig, R as RequireAuthOptions, e as RequireRoleOptions } from '../types-BCTRacMF.js';
|
|
2
|
+
export { i as AuthApiContext, h as AuthConnection, g as AuthConnectionData, f as AuthErrorCode, j as AuthMsgContext, C as ConnectionRequest } from '../types-BCTRacMF.js';
|
|
3
|
+
import { G as GameServer, S as ServerConnection } from '../index-B1sr5YAl.js';
|
|
4
|
+
import { R as Room, P as Player } from '../Room-5owFVIFR.js';
|
|
5
5
|
import '@esengine/rpc';
|
|
6
6
|
import 'node:http';
|
|
7
7
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import '../../index-
|
|
1
|
+
import { I as IAuthProvider, A as AuthResult } from '../../types-BCTRacMF.js';
|
|
2
|
+
import '../../index-B1sr5YAl.js';
|
|
3
3
|
import '@esengine/rpc';
|
|
4
4
|
import 'node:http';
|
|
5
5
|
|