@oox/ws 1.0.1 → 1.0.3
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/adapter.js +2 -1
- package/package.json +1 -1
- package/server.js +1 -0
- package/types/adapter.d.ts +12 -0
package/adapter.js
CHANGED
|
@@ -2,9 +2,10 @@ import { randomUUID } from 'crypto';
|
|
|
2
2
|
import * as oox from 'oox';
|
|
3
3
|
import { SampleKeepAliveConnectionAdapter } from 'oox/samples';
|
|
4
4
|
import { Socket } from './socket.js';
|
|
5
|
-
import { genWebSocketURL } from './utils.js';
|
|
5
|
+
import { OOXEvent, genWebSocketURL } from './utils.js';
|
|
6
6
|
export default class WebSocketAdapter extends SampleKeepAliveConnectionAdapter {
|
|
7
7
|
name = 'ws';
|
|
8
|
+
OOXEvent = OOXEvent;
|
|
8
9
|
newConnection(identify) {
|
|
9
10
|
const { id, name } = oox.config;
|
|
10
11
|
const headers = {
|
package/package.json
CHANGED
package/server.js
CHANGED
|
@@ -165,6 +165,7 @@ export default class WebSocketServer extends Module {
|
|
|
165
165
|
token,
|
|
166
166
|
});
|
|
167
167
|
oox.addKeepAliveConnection(connection);
|
|
168
|
+
connection.emit('connect');
|
|
168
169
|
this.bindServerConnectionEvents(connection);
|
|
169
170
|
socket.emit(OOXEvent.READY, {
|
|
170
171
|
id: oox.config.id,
|
package/types/adapter.d.ts
CHANGED
|
@@ -3,5 +3,17 @@ import { SampleKeepAliveConnectionAdapter } from 'oox/samples';
|
|
|
3
3
|
import { Socket } from './socket.js';
|
|
4
4
|
export default class WebSocketAdapter extends SampleKeepAliveConnectionAdapter<Socket> {
|
|
5
5
|
name: string;
|
|
6
|
+
OOXEvent: {
|
|
7
|
+
CONNECT: string;
|
|
8
|
+
DISCONNECT: string;
|
|
9
|
+
ERROR: string;
|
|
10
|
+
CALL: string;
|
|
11
|
+
READY: string;
|
|
12
|
+
ENABLED: string;
|
|
13
|
+
DISABLED: string;
|
|
14
|
+
REGISTRY_SYNC_CONNECTIONS: string;
|
|
15
|
+
REGISTRY_SUBSCRIBE: string;
|
|
16
|
+
REGISTRY_NOTIFY: string;
|
|
17
|
+
};
|
|
6
18
|
newConnection(identify: string | URL | oox.KeepAliveConnectionData): oox.KeepAliveConnection<Socket>;
|
|
7
19
|
}
|