@asenajs/asena 0.5.0 → 0.6.0-beta.0
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/index.d.ts +0 -1
- package/dist/index.js +0 -1
- package/dist/index.js.map +1 -1
- package/dist/lib/adapter/AsenaAdapter.js.map +1 -1
- package/dist/lib/adapter/AsenaWebsocketAdapter.js.map +1 -1
- package/dist/lib/ioc/CircularDependencyDetector.js.map +1 -1
- package/dist/lib/ioc/Container.js +4 -4
- package/dist/lib/ioc/Container.js.map +1 -1
- package/dist/lib/ioc/CoreContainer.js +7 -0
- package/dist/lib/ioc/CoreContainer.js.map +1 -1
- package/dist/lib/ioc/IocEngine.js +0 -2
- package/dist/lib/ioc/IocEngine.js.map +1 -1
- package/dist/lib/ioc/component/componentUtils.js.map +1 -1
- package/dist/lib/ioc/constants/ComponentConstants.d.ts +2 -0
- package/dist/lib/ioc/constants/ComponentConstants.js +3 -0
- package/dist/lib/ioc/constants/ComponentConstants.js.map +1 -1
- package/dist/lib/ioc/types/ICoreServiceNamesType.d.ts +3 -0
- package/dist/lib/ioc/types/ICoreServiceNamesType.js +4 -0
- package/dist/lib/ioc/types/ICoreServiceNamesType.js.map +1 -1
- package/dist/lib/ioc/types/decorators/ComponentType.d.ts +2 -1
- package/dist/lib/ioc/types/decorators/ComponentType.js +1 -0
- package/dist/lib/ioc/types/decorators/ComponentType.js.map +1 -1
- package/dist/lib/server/AsenaServer.d.ts +1 -0
- package/dist/lib/server/AsenaServer.js +7 -1
- package/dist/lib/server/AsenaServer.js.map +1 -1
- package/dist/lib/server/AsenaServerFactory.js.map +1 -1
- package/dist/lib/server/decorators/components/Controller.js.map +1 -1
- package/dist/lib/server/decorators/components/EventService.d.ts +37 -0
- package/dist/lib/server/decorators/components/EventService.js +47 -0
- package/dist/lib/server/decorators/components/EventService.js.map +1 -0
- package/dist/lib/server/decorators/components/Schedule.js.map +1 -1
- package/dist/lib/server/decorators/components/StaticServe.js +1 -1
- package/dist/lib/server/decorators/components/StaticServe.js.map +1 -1
- package/dist/lib/server/decorators/components/index.d.ts +1 -0
- package/dist/lib/server/decorators/components/index.js +1 -0
- package/dist/lib/server/decorators/components/index.js.map +1 -1
- package/dist/lib/server/decorators/index.d.ts +1 -0
- package/dist/lib/server/decorators/index.js +1 -0
- package/dist/lib/server/decorators/index.js.map +1 -1
- package/dist/lib/server/event/EventDispatchService.d.ts +104 -0
- package/dist/lib/server/event/EventDispatchService.js +203 -0
- package/dist/lib/server/event/EventDispatchService.js.map +1 -0
- package/dist/lib/server/event/EventEmitter.d.ts +67 -0
- package/dist/lib/server/event/EventEmitter.js +88 -0
- package/dist/lib/server/event/EventEmitter.js.map +1 -0
- package/dist/lib/server/event/EventService.d.ts +5 -0
- package/dist/lib/server/event/EventService.js +6 -0
- package/dist/lib/server/event/EventService.js.map +1 -0
- package/dist/lib/server/event/decorators/On.d.ts +38 -0
- package/dist/lib/server/event/decorators/On.js +56 -0
- package/dist/lib/server/event/decorators/On.js.map +1 -0
- package/dist/lib/server/event/decorators/index.d.ts +1 -0
- package/dist/lib/server/event/decorators/index.js +2 -0
- package/dist/lib/server/event/decorators/index.js.map +1 -0
- package/dist/lib/server/event/emitter.d.ts +21 -0
- package/dist/lib/server/event/emitter.js +25 -0
- package/dist/lib/server/event/emitter.js.map +1 -0
- package/dist/lib/server/event/eventPatternMatcher.d.ts +24 -0
- package/dist/lib/server/event/eventPatternMatcher.js +112 -0
- package/dist/lib/server/event/eventPatternMatcher.js.map +1 -0
- package/dist/lib/server/event/index.d.ts +6 -0
- package/dist/lib/server/event/index.js +12 -0
- package/dist/lib/server/event/index.js.map +1 -0
- package/dist/lib/server/event/types.d.ts +70 -0
- package/dist/lib/server/event/types.js +2 -0
- package/dist/lib/server/event/types.js.map +1 -0
- package/dist/lib/server/index.d.ts +0 -2
- package/dist/lib/server/index.js +0 -3
- package/dist/lib/server/index.js.map +1 -1
- package/dist/lib/server/messaging/Ulak.js.map +1 -1
- package/dist/lib/server/messaging/types.js.map +1 -1
- package/dist/lib/server/src/services/PrepareConfigService.js.map +1 -1
- package/dist/lib/server/src/services/PrepareEventService.d.ts +40 -0
- package/dist/lib/server/src/services/PrepareEventService.js +103 -0
- package/dist/lib/server/src/services/PrepareEventService.js.map +1 -0
- package/dist/lib/server/src/services/PrepareMiddlewareService.js.map +1 -1
- package/dist/lib/server/src/services/PrepareStaticServeConfigService.js +3 -3
- package/dist/lib/server/src/services/PrepareStaticServeConfigService.js.map +1 -1
- package/dist/lib/server/src/services/PrepareValidatorService.js.map +1 -1
- package/dist/lib/server/src/services/PrepareWebsocketService.d.ts +1 -1
- package/dist/lib/server/src/services/PrepareWebsocketService.js +2 -2
- package/dist/lib/server/src/services/PrepareWebsocketService.js.map +1 -1
- package/dist/lib/server/web/decorators/http.base.d.ts +1 -1
- package/dist/lib/server/web/decorators/http.base.js +1 -1
- package/dist/lib/server/web/decorators/http.base.js.map +1 -1
- package/dist/lib/server/web/helper/middlewareHelper.d.ts +1 -1
- package/dist/lib/server/web/helper/middlewareHelper.js +1 -1
- package/dist/lib/server/web/helper/middlewareHelper.js.map +1 -1
- package/dist/lib/server/web/middleware/AsenaMiddlewareService.js.map +1 -1
- package/dist/lib/server/web/middleware/AsenaStaticServeService.d.ts +1 -1
- package/dist/lib/server/web/middleware/AsenaStaticServeService.js.map +1 -1
- package/dist/lib/server/web/websocket/AsenaSocket.d.ts +237 -4
- package/dist/lib/server/web/websocket/AsenaSocket.js +234 -32
- package/dist/lib/server/web/websocket/AsenaSocket.js.map +1 -1
- package/dist/lib/server/web/websocket/AsenaWebSocketServer.js.map +1 -1
- package/dist/lib/server/web/websocket/AsenaWebSocketService.d.ts +0 -13
- package/dist/lib/server/web/websocket/AsenaWebSocketService.js +1 -21
- package/dist/lib/server/web/websocket/AsenaWebSocketService.js.map +1 -1
- package/dist/lib/utils/index.d.ts +2 -0
- package/dist/lib/utils/index.js +3 -0
- package/dist/lib/utils/index.js.map +1 -0
- package/dist/lib/utils/typedMetadata.js +0 -1
- package/dist/lib/utils/typedMetadata.js.map +1 -1
- package/package.json +25 -14
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { AsenaContext } from '../../../adapter';
|
|
2
|
-
import type { ComponentParams } from '../../../ioc
|
|
2
|
+
import type { ComponentParams } from '../../../ioc';
|
|
3
3
|
import type { Class } from '../../types';
|
|
4
4
|
/**
|
|
5
5
|
* Abstract configuration class for serving static files in Asena applications.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AsenaStaticServeService.js","sourceRoot":"","sources":["../../../../../lib/server/web/middleware/AsenaStaticServeService.ts"],"names":[],"mappings":"AAIA;;;;;;GAMG;AACH,MAAM,OAAgB,uBAAuB;
|
|
1
|
+
{"version":3,"file":"AsenaStaticServeService.js","sourceRoot":"","sources":["../../../../../lib/server/web/middleware/AsenaStaticServeService.ts"],"names":[],"mappings":"AAIA;;;;;;GAMG;AACH,MAAM,OAAgB,uBAAuB;IAC3C;;;OAGG;IACI,KAAK,CAAK;IAEjB;;;OAGG;IACO,IAAI,CAAU;CA2BzB"}
|
|
@@ -1,42 +1,275 @@
|
|
|
1
1
|
import type { ServerWebSocket, ServerWebSocketSendStatus, WebSocketReadyState } from 'bun';
|
|
2
2
|
import type { WebSocketData } from './types';
|
|
3
|
-
|
|
3
|
+
/**
|
|
4
|
+
* Wrapper class for Bun's ServerWebSocket that provides Asena-specific WebSocket functionality.
|
|
5
|
+
* This class acts as a facade over the native Bun WebSocket implementation, adding features like
|
|
6
|
+
* namespace-based topic management, room subscriptions, and automatic cleanup.
|
|
7
|
+
*
|
|
8
|
+
* @template T - Custom data type to be attached to the WebSocket connection
|
|
9
|
+
*
|
|
10
|
+
* @example
|
|
11
|
+
* ```typescript
|
|
12
|
+
* const socket = new AsenaSocket(ws, websocketService);
|
|
13
|
+
* socket.subscribe('chat-room');
|
|
14
|
+
* socket.publish('chat-room', 'Hello everyone!');
|
|
15
|
+
* socket.unsubscribe('chat-room');
|
|
16
|
+
* ```
|
|
17
|
+
*/
|
|
4
18
|
export declare class AsenaSocket<T> implements ServerWebSocket<WebSocketData<T>> {
|
|
19
|
+
/**
|
|
20
|
+
* The underlying Bun ServerWebSocket instance.
|
|
21
|
+
* @private
|
|
22
|
+
*/
|
|
5
23
|
private ws;
|
|
24
|
+
/**
|
|
25
|
+
* Cached remote IP address of the client.
|
|
26
|
+
* @private
|
|
27
|
+
*/
|
|
6
28
|
private _remoteAddress;
|
|
29
|
+
/**
|
|
30
|
+
* Cached WebSocket connection state.
|
|
31
|
+
* @private
|
|
32
|
+
*/
|
|
7
33
|
private _readyState;
|
|
34
|
+
/**
|
|
35
|
+
* Cached binary data type preference.
|
|
36
|
+
* @private
|
|
37
|
+
*/
|
|
8
38
|
private _binaryType?;
|
|
39
|
+
/**
|
|
40
|
+
* Custom data attached to this WebSocket connection.
|
|
41
|
+
* @private
|
|
42
|
+
*/
|
|
9
43
|
private _data;
|
|
44
|
+
/**
|
|
45
|
+
* Unique identifier for this socket connection.
|
|
46
|
+
* @private
|
|
47
|
+
*/
|
|
10
48
|
private _id;
|
|
11
|
-
|
|
12
|
-
|
|
49
|
+
/**
|
|
50
|
+
* The namespace this socket belongs to.
|
|
51
|
+
* @private
|
|
52
|
+
*/
|
|
53
|
+
private _namespace;
|
|
54
|
+
/**
|
|
55
|
+
* Creates a new AsenaSocket instance wrapping a Bun ServerWebSocket.
|
|
56
|
+
*
|
|
57
|
+
* @param ws - The native Bun ServerWebSocket instance to wrap
|
|
58
|
+
* @param namespace - The namespace this socket belongs to
|
|
59
|
+
*/
|
|
60
|
+
constructor(ws: ServerWebSocket<WebSocketData<T>>, namespace: string);
|
|
61
|
+
/**
|
|
62
|
+
* Sends data to the client. Automatically detects whether data is text or binary.
|
|
63
|
+
*
|
|
64
|
+
* @param data - The data to send (string for text, ArrayBufferLike or DataView for binary)
|
|
65
|
+
* @param compress - Whether to compress the data (default: false)
|
|
66
|
+
* @returns The send status indicating success or failure
|
|
67
|
+
*/
|
|
13
68
|
send(data: string | ArrayBufferLike | DataView, compress?: boolean): ServerWebSocketSendStatus;
|
|
69
|
+
/**
|
|
70
|
+
* Sends text data to the client.
|
|
71
|
+
*
|
|
72
|
+
* @param data - The text string to send
|
|
73
|
+
* @param compress - Whether to compress the data (default: false)
|
|
74
|
+
* @returns The send status indicating success or failure
|
|
75
|
+
*/
|
|
14
76
|
sendText(data: string, compress?: boolean): ServerWebSocketSendStatus;
|
|
77
|
+
/**
|
|
78
|
+
* Sends binary data to the client.
|
|
79
|
+
*
|
|
80
|
+
* @param data - The binary data to send (ArrayBuffer, TypedArray, or DataView)
|
|
81
|
+
* @param compress - Whether to compress the data (default: false)
|
|
82
|
+
* @returns The send status indicating success or failure
|
|
83
|
+
*/
|
|
15
84
|
sendBinary(data: ArrayBufferLike | DataView, compress?: boolean): ServerWebSocketSendStatus;
|
|
85
|
+
/**
|
|
86
|
+
* Gracefully closes the WebSocket connection with an optional status code and reason.
|
|
87
|
+
*
|
|
88
|
+
* @param code - Optional WebSocket close code (default: 1000 for normal closure)
|
|
89
|
+
* @param reason - Optional human-readable reason for closing
|
|
90
|
+
*/
|
|
16
91
|
close(code?: number, reason?: string): void;
|
|
92
|
+
/**
|
|
93
|
+
* Immediately terminates the WebSocket connection without sending a close frame.
|
|
94
|
+
* Use this for forceful disconnections; prefer close() for graceful shutdowns.
|
|
95
|
+
*/
|
|
17
96
|
terminate(): void;
|
|
97
|
+
/**
|
|
98
|
+
* Sends a ping frame to the client to check connection liveness.
|
|
99
|
+
* The client should respond with a pong frame.
|
|
100
|
+
*
|
|
101
|
+
* @param data - Optional data to include in the ping frame
|
|
102
|
+
* @returns The send status indicating success or failure
|
|
103
|
+
*/
|
|
18
104
|
ping(data?: string | ArrayBufferLike | DataView): ServerWebSocketSendStatus;
|
|
105
|
+
/**
|
|
106
|
+
* Sends a pong frame to the client, typically in response to a ping.
|
|
107
|
+
*
|
|
108
|
+
* @param data - Optional data to include in the pong frame
|
|
109
|
+
* @returns The send status indicating success or failure
|
|
110
|
+
*/
|
|
19
111
|
pong(data?: string | ArrayBufferLike | DataView): ServerWebSocketSendStatus;
|
|
112
|
+
/**
|
|
113
|
+
* Publishes data to all clients subscribed to the specified topic.
|
|
114
|
+
* The topic is automatically prefixed with the namespace.
|
|
115
|
+
*
|
|
116
|
+
* @param topic - The topic name to publish to (will be prefixed with namespace)
|
|
117
|
+
* @param data - The data to publish (string, ArrayBuffer, TypedArray, or DataView)
|
|
118
|
+
* @param compress - Whether to compress the data (default: false)
|
|
119
|
+
* @returns The send status indicating success or failure
|
|
120
|
+
*
|
|
121
|
+
* @example
|
|
122
|
+
* ```typescript
|
|
123
|
+
* socket.publish('chat-room', 'Hello everyone!');
|
|
124
|
+
* ```
|
|
125
|
+
*/
|
|
20
126
|
publish(topic: string, data: string | ArrayBufferLike | DataView, compress?: boolean): ServerWebSocketSendStatus;
|
|
127
|
+
/**
|
|
128
|
+
* Publishes text data to all clients subscribed to the specified topic.
|
|
129
|
+
* The topic is automatically prefixed with the namespace.
|
|
130
|
+
*
|
|
131
|
+
* @param topic - The topic name to publish to (will be prefixed with namespace)
|
|
132
|
+
* @param data - The text string to publish
|
|
133
|
+
* @param compress - Whether to compress the data (default: false)
|
|
134
|
+
* @returns The send status indicating success or failure
|
|
135
|
+
*/
|
|
21
136
|
publishText(topic: string, data: string, compress?: boolean): ServerWebSocketSendStatus;
|
|
137
|
+
/**
|
|
138
|
+
* Publishes binary data to all clients subscribed to the specified topic.
|
|
139
|
+
* The topic is automatically prefixed with the namespace.
|
|
140
|
+
*
|
|
141
|
+
* @param topic - The topic name to publish to (will be prefixed with namespace)
|
|
142
|
+
* @param data - The binary data to publish (ArrayBuffer, TypedArray, or DataView)
|
|
143
|
+
* @param compress - Whether to compress the data (default: false)
|
|
144
|
+
* @returns The send status indicating success or failure
|
|
145
|
+
*/
|
|
22
146
|
publishBinary(topic: string, data: ArrayBufferLike | DataView, compress?: boolean): ServerWebSocketSendStatus;
|
|
147
|
+
/**
|
|
148
|
+
* Subscribes this socket to a topic/room. Once subscribed, the socket will receive
|
|
149
|
+
* all messages published to this topic. The topic is automatically prefixed with the namespace.
|
|
150
|
+
*
|
|
151
|
+
* @param topic - The topic/room name to subscribe to
|
|
152
|
+
*
|
|
153
|
+
* @example
|
|
154
|
+
* ```typescript
|
|
155
|
+
* socket.subscribe('notifications');
|
|
156
|
+
* socket.subscribe('user-123-events');
|
|
157
|
+
* ```
|
|
158
|
+
*/
|
|
23
159
|
subscribe(topic: string): void;
|
|
160
|
+
/**
|
|
161
|
+
* Unsubscribes this socket from a topic/room. The socket will no longer receive
|
|
162
|
+
* messages published to this topic. The topic is automatically prefixed with the namespace.
|
|
163
|
+
*
|
|
164
|
+
* @param topic - The topic/room name to unsubscribe from
|
|
165
|
+
*
|
|
166
|
+
* @example
|
|
167
|
+
* ```typescript
|
|
168
|
+
* socket.unsubscribe('notifications');
|
|
169
|
+
* ```
|
|
170
|
+
*/
|
|
24
171
|
unsubscribe(topic: string): void;
|
|
25
|
-
|
|
172
|
+
/**
|
|
173
|
+
* Checks if this socket is currently subscribed to a specific topic/room.
|
|
174
|
+
* The topic is automatically prefixed with the namespace.
|
|
175
|
+
*
|
|
176
|
+
* @param topic - The topic/room name to check
|
|
177
|
+
* @returns True if subscribed, false otherwise
|
|
178
|
+
*/
|
|
26
179
|
isSubscribed(topic: string): boolean;
|
|
180
|
+
/**
|
|
181
|
+
* Batches multiple send operations together for improved performance.
|
|
182
|
+
* All socket operations within the callback will be buffered and sent together.
|
|
183
|
+
* This is useful when sending multiple messages at once to reduce syscalls.
|
|
184
|
+
*
|
|
185
|
+
* @template T - The return type of the callback
|
|
186
|
+
* @param callback - The function containing socket operations to batch
|
|
187
|
+
* @returns The return value of the callback
|
|
188
|
+
*
|
|
189
|
+
* @example
|
|
190
|
+
* ```typescript
|
|
191
|
+
* socket.cork(() => {
|
|
192
|
+
* socket.send('message 1');
|
|
193
|
+
* socket.send('message 2');
|
|
194
|
+
* socket.send('message 3');
|
|
195
|
+
* return 'done';
|
|
196
|
+
* });
|
|
197
|
+
* ```
|
|
198
|
+
*/
|
|
27
199
|
cork<T = unknown>(callback: (ws: ServerWebSocket<T>) => T): T;
|
|
200
|
+
/**
|
|
201
|
+
* Gets the remote IP address of the client.
|
|
202
|
+
*/
|
|
28
203
|
get remoteAddress(): string;
|
|
204
|
+
/**
|
|
205
|
+
* Sets the remote IP address of the client.
|
|
206
|
+
*/
|
|
29
207
|
set remoteAddress(value: string);
|
|
208
|
+
/**
|
|
209
|
+
* Gets the binary data type used for binary messages.
|
|
210
|
+
* - 'nodebuffer': Node.js Buffer
|
|
211
|
+
* - 'arraybuffer': JavaScript ArrayBuffer
|
|
212
|
+
* - 'uint8array': JavaScript Uint8Array
|
|
213
|
+
*/
|
|
30
214
|
get binaryType(): 'nodebuffer' | 'arraybuffer' | 'uint8array';
|
|
215
|
+
/**
|
|
216
|
+
* Sets the binary data type used for binary messages.
|
|
217
|
+
*/
|
|
31
218
|
set binaryType(value: 'nodebuffer' | 'arraybuffer' | 'uint8array');
|
|
219
|
+
/**
|
|
220
|
+
* Gets the current state of the WebSocket connection.
|
|
221
|
+
* - 0 (CONNECTING): Connection is being established
|
|
222
|
+
* - 1 (OPEN): Connection is open and ready to communicate
|
|
223
|
+
* - 2 (CLOSING): Connection is being closed
|
|
224
|
+
* - 3 (CLOSED): Connection is closed
|
|
225
|
+
*/
|
|
32
226
|
get readyState(): WebSocketReadyState;
|
|
227
|
+
/**
|
|
228
|
+
* Sets the current state of the WebSocket connection.
|
|
229
|
+
*/
|
|
33
230
|
set readyState(value: WebSocketReadyState);
|
|
231
|
+
/**
|
|
232
|
+
* Gets the custom data attached to this WebSocket connection.
|
|
233
|
+
* This data is persisted throughout the connection lifecycle.
|
|
234
|
+
*/
|
|
34
235
|
get data(): WebSocketData<T>;
|
|
236
|
+
/**
|
|
237
|
+
* Sets the custom data attached to this WebSocket connection.
|
|
238
|
+
*/
|
|
35
239
|
set data(value: WebSocketData<T>);
|
|
240
|
+
/**
|
|
241
|
+
* Gets the namespace this socket belongs to.
|
|
242
|
+
* The namespace is used to prefix all topic names for isolation.
|
|
243
|
+
*/
|
|
36
244
|
get namespace(): string;
|
|
245
|
+
/**
|
|
246
|
+
* Gets the unique identifier for this socket connection.
|
|
247
|
+
*/
|
|
37
248
|
get id(): string;
|
|
249
|
+
/**
|
|
250
|
+
* Sets the unique identifier for this socket connection.
|
|
251
|
+
*/
|
|
38
252
|
set id(value: string);
|
|
253
|
+
/**
|
|
254
|
+
* Returns the number of bytes currently buffered (queued but not yet sent).
|
|
255
|
+
* Useful for flow control and detecting backpressure.
|
|
256
|
+
*
|
|
257
|
+
* @returns The number of bytes buffered
|
|
258
|
+
*/
|
|
39
259
|
getBufferedAmount(): number;
|
|
260
|
+
/**
|
|
261
|
+
* Creates a namespaced topic by prefixing the topic name with the socket's namespace.
|
|
262
|
+
* This ensures topic isolation between different WebSocket services.
|
|
263
|
+
*
|
|
264
|
+
* @param topic - The topic name to namespace
|
|
265
|
+
* @returns The namespaced topic in format "namespace.topic"
|
|
266
|
+
* @private
|
|
267
|
+
*/
|
|
40
268
|
private createTopic;
|
|
41
269
|
}
|
|
270
|
+
/**
|
|
271
|
+
* Type alias for AsenaSocket for convenience and backwards compatibility.
|
|
272
|
+
*
|
|
273
|
+
* @template T - Custom data type attached to the WebSocket connection
|
|
274
|
+
*/
|
|
42
275
|
export type Socket<T = any> = AsenaSocket<T>;
|
|
@@ -1,126 +1,328 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Wrapper class for Bun's ServerWebSocket that provides Asena-specific WebSocket functionality.
|
|
3
|
+
* This class acts as a facade over the native Bun WebSocket implementation, adding features like
|
|
4
|
+
* namespace-based topic management, room subscriptions, and automatic cleanup.
|
|
5
|
+
*
|
|
6
|
+
* @template T - Custom data type to be attached to the WebSocket connection
|
|
7
|
+
*
|
|
8
|
+
* @example
|
|
9
|
+
* ```typescript
|
|
10
|
+
* const socket = new AsenaSocket(ws, websocketService);
|
|
11
|
+
* socket.subscribe('chat-room');
|
|
12
|
+
* socket.publish('chat-room', 'Hello everyone!');
|
|
13
|
+
* socket.unsubscribe('chat-room');
|
|
14
|
+
* ```
|
|
15
|
+
*/
|
|
1
16
|
export class AsenaSocket {
|
|
17
|
+
/**
|
|
18
|
+
* The underlying Bun ServerWebSocket instance.
|
|
19
|
+
* @private
|
|
20
|
+
*/
|
|
2
21
|
ws;
|
|
22
|
+
/**
|
|
23
|
+
* Cached remote IP address of the client.
|
|
24
|
+
* @private
|
|
25
|
+
*/
|
|
3
26
|
_remoteAddress;
|
|
27
|
+
/**
|
|
28
|
+
* Cached WebSocket connection state.
|
|
29
|
+
* @private
|
|
30
|
+
*/
|
|
4
31
|
_readyState;
|
|
32
|
+
/**
|
|
33
|
+
* Cached binary data type preference.
|
|
34
|
+
* @private
|
|
35
|
+
*/
|
|
5
36
|
_binaryType;
|
|
37
|
+
/**
|
|
38
|
+
* Custom data attached to this WebSocket connection.
|
|
39
|
+
* @private
|
|
40
|
+
*/
|
|
6
41
|
_data;
|
|
42
|
+
/**
|
|
43
|
+
* Unique identifier for this socket connection.
|
|
44
|
+
* @private
|
|
45
|
+
*/
|
|
7
46
|
_id;
|
|
8
|
-
|
|
9
|
-
|
|
47
|
+
/**
|
|
48
|
+
* The namespace this socket belongs to.
|
|
49
|
+
* @private
|
|
50
|
+
*/
|
|
51
|
+
_namespace;
|
|
52
|
+
/**
|
|
53
|
+
* Creates a new AsenaSocket instance wrapping a Bun ServerWebSocket.
|
|
54
|
+
*
|
|
55
|
+
* @param ws - The native Bun ServerWebSocket instance to wrap
|
|
56
|
+
* @param namespace - The namespace this socket belongs to
|
|
57
|
+
*/
|
|
58
|
+
constructor(ws, namespace) {
|
|
10
59
|
this.ws = ws;
|
|
11
60
|
this._data = ws.data;
|
|
12
61
|
this._id = ws.data.id;
|
|
13
62
|
this._remoteAddress = ws.remoteAddress;
|
|
14
63
|
this._binaryType = ws.binaryType;
|
|
15
64
|
this._readyState = ws.readyState;
|
|
16
|
-
this.
|
|
65
|
+
this._namespace = namespace;
|
|
17
66
|
}
|
|
67
|
+
/**
|
|
68
|
+
* Sends data to the client. Automatically detects whether data is text or binary.
|
|
69
|
+
*
|
|
70
|
+
* @param data - The data to send (string for text, ArrayBufferLike or DataView for binary)
|
|
71
|
+
* @param compress - Whether to compress the data (default: false)
|
|
72
|
+
* @returns The send status indicating success or failure
|
|
73
|
+
*/
|
|
18
74
|
send(data, compress) {
|
|
19
75
|
return this.ws.send(data, compress);
|
|
20
76
|
}
|
|
77
|
+
/**
|
|
78
|
+
* Sends text data to the client.
|
|
79
|
+
*
|
|
80
|
+
* @param data - The text string to send
|
|
81
|
+
* @param compress - Whether to compress the data (default: false)
|
|
82
|
+
* @returns The send status indicating success or failure
|
|
83
|
+
*/
|
|
21
84
|
sendText(data, compress) {
|
|
22
85
|
return this.ws.sendText(data, compress);
|
|
23
86
|
}
|
|
87
|
+
/**
|
|
88
|
+
* Sends binary data to the client.
|
|
89
|
+
*
|
|
90
|
+
* @param data - The binary data to send (ArrayBuffer, TypedArray, or DataView)
|
|
91
|
+
* @param compress - Whether to compress the data (default: false)
|
|
92
|
+
* @returns The send status indicating success or failure
|
|
93
|
+
*/
|
|
24
94
|
sendBinary(data, compress) {
|
|
25
95
|
return this.ws.sendBinary(data, compress);
|
|
26
96
|
}
|
|
97
|
+
/**
|
|
98
|
+
* Gracefully closes the WebSocket connection with an optional status code and reason.
|
|
99
|
+
*
|
|
100
|
+
* @param code - Optional WebSocket close code (default: 1000 for normal closure)
|
|
101
|
+
* @param reason - Optional human-readable reason for closing
|
|
102
|
+
*/
|
|
27
103
|
close(code, reason) {
|
|
28
|
-
this.cleanup();
|
|
29
104
|
this.ws.close(code, reason);
|
|
30
105
|
}
|
|
106
|
+
/**
|
|
107
|
+
* Immediately terminates the WebSocket connection without sending a close frame.
|
|
108
|
+
* Use this for forceful disconnections; prefer close() for graceful shutdowns.
|
|
109
|
+
*/
|
|
31
110
|
terminate() {
|
|
32
|
-
this.cleanup();
|
|
33
111
|
this.ws.terminate();
|
|
34
112
|
}
|
|
113
|
+
/**
|
|
114
|
+
* Sends a ping frame to the client to check connection liveness.
|
|
115
|
+
* The client should respond with a pong frame.
|
|
116
|
+
*
|
|
117
|
+
* @param data - Optional data to include in the ping frame
|
|
118
|
+
* @returns The send status indicating success or failure
|
|
119
|
+
*/
|
|
35
120
|
ping(data) {
|
|
36
121
|
return this.ws.ping(data);
|
|
37
122
|
}
|
|
123
|
+
/**
|
|
124
|
+
* Sends a pong frame to the client, typically in response to a ping.
|
|
125
|
+
*
|
|
126
|
+
* @param data - Optional data to include in the pong frame
|
|
127
|
+
* @returns The send status indicating success or failure
|
|
128
|
+
*/
|
|
38
129
|
pong(data) {
|
|
39
130
|
return this.ws.pong(data);
|
|
40
131
|
}
|
|
132
|
+
/**
|
|
133
|
+
* Publishes data to all clients subscribed to the specified topic.
|
|
134
|
+
* The topic is automatically prefixed with the namespace.
|
|
135
|
+
*
|
|
136
|
+
* @param topic - The topic name to publish to (will be prefixed with namespace)
|
|
137
|
+
* @param data - The data to publish (string, ArrayBuffer, TypedArray, or DataView)
|
|
138
|
+
* @param compress - Whether to compress the data (default: false)
|
|
139
|
+
* @returns The send status indicating success or failure
|
|
140
|
+
*
|
|
141
|
+
* @example
|
|
142
|
+
* ```typescript
|
|
143
|
+
* socket.publish('chat-room', 'Hello everyone!');
|
|
144
|
+
* ```
|
|
145
|
+
*/
|
|
41
146
|
publish(topic, data, compress) {
|
|
42
147
|
return this.ws.publish(this.createTopic(topic), data, compress);
|
|
43
148
|
}
|
|
149
|
+
/**
|
|
150
|
+
* Publishes text data to all clients subscribed to the specified topic.
|
|
151
|
+
* The topic is automatically prefixed with the namespace.
|
|
152
|
+
*
|
|
153
|
+
* @param topic - The topic name to publish to (will be prefixed with namespace)
|
|
154
|
+
* @param data - The text string to publish
|
|
155
|
+
* @param compress - Whether to compress the data (default: false)
|
|
156
|
+
* @returns The send status indicating success or failure
|
|
157
|
+
*/
|
|
44
158
|
publishText(topic, data, compress) {
|
|
45
159
|
return this.ws.publishText(this.createTopic(topic), data, compress);
|
|
46
160
|
}
|
|
161
|
+
/**
|
|
162
|
+
* Publishes binary data to all clients subscribed to the specified topic.
|
|
163
|
+
* The topic is automatically prefixed with the namespace.
|
|
164
|
+
*
|
|
165
|
+
* @param topic - The topic name to publish to (will be prefixed with namespace)
|
|
166
|
+
* @param data - The binary data to publish (ArrayBuffer, TypedArray, or DataView)
|
|
167
|
+
* @param compress - Whether to compress the data (default: false)
|
|
168
|
+
* @returns The send status indicating success or failure
|
|
169
|
+
*/
|
|
47
170
|
publishBinary(topic, data, compress) {
|
|
48
171
|
return this.ws.publishBinary(this.createTopic(topic), data, compress);
|
|
49
172
|
}
|
|
173
|
+
/**
|
|
174
|
+
* Subscribes this socket to a topic/room. Once subscribed, the socket will receive
|
|
175
|
+
* all messages published to this topic. The topic is automatically prefixed with the namespace.
|
|
176
|
+
*
|
|
177
|
+
* @param topic - The topic/room name to subscribe to
|
|
178
|
+
*
|
|
179
|
+
* @example
|
|
180
|
+
* ```typescript
|
|
181
|
+
* socket.subscribe('notifications');
|
|
182
|
+
* socket.subscribe('user-123-events');
|
|
183
|
+
* ```
|
|
184
|
+
*/
|
|
50
185
|
subscribe(topic) {
|
|
51
|
-
const room = this._websocketService.rooms.get(topic);
|
|
52
|
-
if (room) {
|
|
53
|
-
room.push(this);
|
|
54
|
-
}
|
|
55
|
-
else {
|
|
56
|
-
this._websocketService.rooms.set(topic, [this]);
|
|
57
|
-
}
|
|
58
186
|
this.ws.subscribe(this.createTopic(topic));
|
|
59
187
|
}
|
|
188
|
+
/**
|
|
189
|
+
* Unsubscribes this socket from a topic/room. The socket will no longer receive
|
|
190
|
+
* messages published to this topic. The topic is automatically prefixed with the namespace.
|
|
191
|
+
*
|
|
192
|
+
* @param topic - The topic/room name to unsubscribe from
|
|
193
|
+
*
|
|
194
|
+
* @example
|
|
195
|
+
* ```typescript
|
|
196
|
+
* socket.unsubscribe('notifications');
|
|
197
|
+
* ```
|
|
198
|
+
*/
|
|
60
199
|
unsubscribe(topic) {
|
|
61
|
-
const room = this._websocketService.rooms.get(topic);
|
|
62
|
-
if (room) {
|
|
63
|
-
// Filter out this socket instead of splice for better safety
|
|
64
|
-
const filteredRoom = room.filter((s) => s.id !== this.id);
|
|
65
|
-
if (filteredRoom.length === 0) {
|
|
66
|
-
this._websocketService.rooms.delete(topic);
|
|
67
|
-
}
|
|
68
|
-
else if (filteredRoom.length !== room.length) {
|
|
69
|
-
// Only update if we actually removed something
|
|
70
|
-
this._websocketService.rooms.set(topic, filteredRoom);
|
|
71
|
-
}
|
|
72
|
-
}
|
|
73
200
|
this.ws.unsubscribe(this.createTopic(topic));
|
|
74
201
|
}
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
202
|
+
/**
|
|
203
|
+
* Checks if this socket is currently subscribed to a specific topic/room.
|
|
204
|
+
* The topic is automatically prefixed with the namespace.
|
|
205
|
+
*
|
|
206
|
+
* @param topic - The topic/room name to check
|
|
207
|
+
* @returns True if subscribed, false otherwise
|
|
208
|
+
*/
|
|
82
209
|
isSubscribed(topic) {
|
|
83
210
|
return this.ws.isSubscribed(this.createTopic(topic));
|
|
84
211
|
}
|
|
212
|
+
/**
|
|
213
|
+
* Batches multiple send operations together for improved performance.
|
|
214
|
+
* All socket operations within the callback will be buffered and sent together.
|
|
215
|
+
* This is useful when sending multiple messages at once to reduce syscalls.
|
|
216
|
+
*
|
|
217
|
+
* @template T - The return type of the callback
|
|
218
|
+
* @param callback - The function containing socket operations to batch
|
|
219
|
+
* @returns The return value of the callback
|
|
220
|
+
*
|
|
221
|
+
* @example
|
|
222
|
+
* ```typescript
|
|
223
|
+
* socket.cork(() => {
|
|
224
|
+
* socket.send('message 1');
|
|
225
|
+
* socket.send('message 2');
|
|
226
|
+
* socket.send('message 3');
|
|
227
|
+
* return 'done';
|
|
228
|
+
* });
|
|
229
|
+
* ```
|
|
230
|
+
*/
|
|
85
231
|
cork(callback) {
|
|
86
232
|
return this.ws.cork(callback);
|
|
87
233
|
}
|
|
234
|
+
/**
|
|
235
|
+
* Gets the remote IP address of the client.
|
|
236
|
+
*/
|
|
88
237
|
get remoteAddress() {
|
|
89
238
|
return this._remoteAddress;
|
|
90
239
|
}
|
|
240
|
+
/**
|
|
241
|
+
* Sets the remote IP address of the client.
|
|
242
|
+
*/
|
|
91
243
|
set remoteAddress(value) {
|
|
92
244
|
this._remoteAddress = value;
|
|
93
245
|
}
|
|
246
|
+
/**
|
|
247
|
+
* Gets the binary data type used for binary messages.
|
|
248
|
+
* - 'nodebuffer': Node.js Buffer
|
|
249
|
+
* - 'arraybuffer': JavaScript ArrayBuffer
|
|
250
|
+
* - 'uint8array': JavaScript Uint8Array
|
|
251
|
+
*/
|
|
94
252
|
get binaryType() {
|
|
95
253
|
return this._binaryType;
|
|
96
254
|
}
|
|
255
|
+
/**
|
|
256
|
+
* Sets the binary data type used for binary messages.
|
|
257
|
+
*/
|
|
97
258
|
set binaryType(value) {
|
|
98
259
|
this._binaryType = value;
|
|
99
260
|
}
|
|
261
|
+
/**
|
|
262
|
+
* Gets the current state of the WebSocket connection.
|
|
263
|
+
* - 0 (CONNECTING): Connection is being established
|
|
264
|
+
* - 1 (OPEN): Connection is open and ready to communicate
|
|
265
|
+
* - 2 (CLOSING): Connection is being closed
|
|
266
|
+
* - 3 (CLOSED): Connection is closed
|
|
267
|
+
*/
|
|
100
268
|
get readyState() {
|
|
101
269
|
return this._readyState;
|
|
102
270
|
}
|
|
271
|
+
/**
|
|
272
|
+
* Sets the current state of the WebSocket connection.
|
|
273
|
+
*/
|
|
103
274
|
set readyState(value) {
|
|
104
275
|
this._readyState = value;
|
|
105
276
|
}
|
|
277
|
+
/**
|
|
278
|
+
* Gets the custom data attached to this WebSocket connection.
|
|
279
|
+
* This data is persisted throughout the connection lifecycle.
|
|
280
|
+
*/
|
|
106
281
|
get data() {
|
|
107
282
|
return this._data;
|
|
108
283
|
}
|
|
284
|
+
/**
|
|
285
|
+
* Sets the custom data attached to this WebSocket connection.
|
|
286
|
+
*/
|
|
109
287
|
set data(value) {
|
|
110
288
|
this._data = value;
|
|
111
289
|
}
|
|
290
|
+
/**
|
|
291
|
+
* Gets the namespace this socket belongs to.
|
|
292
|
+
* The namespace is used to prefix all topic names for isolation.
|
|
293
|
+
*/
|
|
112
294
|
get namespace() {
|
|
113
|
-
return this.
|
|
295
|
+
return this._namespace;
|
|
114
296
|
}
|
|
297
|
+
/**
|
|
298
|
+
* Gets the unique identifier for this socket connection.
|
|
299
|
+
*/
|
|
115
300
|
get id() {
|
|
116
301
|
return this._id;
|
|
117
302
|
}
|
|
303
|
+
/**
|
|
304
|
+
* Sets the unique identifier for this socket connection.
|
|
305
|
+
*/
|
|
118
306
|
set id(value) {
|
|
119
307
|
this._id = value;
|
|
120
308
|
}
|
|
309
|
+
/**
|
|
310
|
+
* Returns the number of bytes currently buffered (queued but not yet sent).
|
|
311
|
+
* Useful for flow control and detecting backpressure.
|
|
312
|
+
*
|
|
313
|
+
* @returns The number of bytes buffered
|
|
314
|
+
*/
|
|
121
315
|
getBufferedAmount() {
|
|
122
316
|
return this.ws.getBufferedAmount();
|
|
123
317
|
}
|
|
318
|
+
/**
|
|
319
|
+
* Creates a namespaced topic by prefixing the topic name with the socket's namespace.
|
|
320
|
+
* This ensures topic isolation between different WebSocket services.
|
|
321
|
+
*
|
|
322
|
+
* @param topic - The topic name to namespace
|
|
323
|
+
* @returns The namespaced topic in format "namespace.topic"
|
|
324
|
+
* @private
|
|
325
|
+
*/
|
|
124
326
|
createTopic(topic) {
|
|
125
327
|
return `${this.namespace}.${topic}`;
|
|
126
328
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AsenaSocket.js","sourceRoot":"","sources":["../../../../../lib/server/web/websocket/AsenaSocket.ts"],"names":[],"mappings":"
|
|
1
|
+
{"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AW,EAAE;QACX,OAAO,IAAI,CAAC,GAAG,CAAC;IAClB,CAAC;IAED;;OAEG;IACH,IAAW,EAAE,CAAC,KAAa;QACzB,IAAI,CAAC,GAAG,GAAG,KAAK,CAAC;IACnB,CAAC;IAED;;;;;OAKG;IACI,iBAAiB;QACtB,OAAO,IAAI,CAAC,EAAE,CAAC,iBAAiB,EAAE,CAAC;IACrC,CAAC;IAED;;;;;;;OAOG;IACK,WAAW,CAAC,KAAa;QAC/B,OAAO,GAAG,IAAI,CAAC,SAAS,IAAI,KAAK,EAAE,CAAC;IACtC,CAAC;CACF"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AsenaWebSocketServer.js","sourceRoot":"","sources":["../../../../../lib/server/web/websocket/AsenaWebSocketServer.ts"],"names":[],"mappings":"AAEA;;;;;GAKG;AACH,MAAM,OAAO,oBAAoB;
|
|
1
|
+
{"version":3,"file":"AsenaWebSocketServer.js","sourceRoot":"","sources":["../../../../../lib/server/web/websocket/AsenaWebSocketServer.ts"],"names":[],"mappings":"AAEA;;;;;GAKG;AACH,MAAM,OAAO,oBAAoB;IAC/B;;;OAGG;IACK,MAAM,CAAc;IAE5B;;;;OAIG;IACH,YAAmB,MAAmB;QACpC,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;IACvB,CAAC;IAED;;;;;;OAMG;IACI,EAAE,CAAC,SAAiB,EAAE,IAAU;QACrC,IAAI,IAAI,YAAY,WAAW,IAAI,IAAI,YAAY,QAAQ,IAAI,IAAI,YAAY,iBAAiB,EAAE,CAAC;YACjG,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,SAAS,EAAE,IAAI,CAAC,CAAC;YACrC,OAAO;QACT,CAAC;QAED,IAAI,CAAC,OAAO,IAAI,KAAK,QAAQ,IAAI,OAAO,IAAI,KAAK,QAAQ,CAAC,IAAI,IAAI,KAAK,IAAI,EAAE,CAAC;YAC5E,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,SAAS,EAAE,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC,CAAC;QACvD,CAAC;aAAM,IAAI,OAAO,IAAI,KAAK,QAAQ,IAAI,IAAI,KAAK,IAAI,IAAI,IAAI,KAAK,SAAS,EAAE,CAAC;YAC3E,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,SAAS,EAAE,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC;QAC/C,CAAC;IACH,CAAC;IAED;;;;;OAKG;IACI,EAAE,CAAC,SAAiB,EAAE,IAAU;QACrC,IAAI,CAAC,EAAE,CAAC,SAAS,EAAE,IAAI,CAAC,CAAC;IAC3B,CAAC;CACF"}
|