@dokebi/websocket 0.4.2 → 0.4.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/AI.md +1 -1
- package/dist/gateway.js +8 -2
- package/dist/index.js +1 -1
- package/package.json +3 -3
package/AI.md
CHANGED
|
@@ -143,7 +143,7 @@ stop: block new work → wait for received handlers and broadcasts being sent
|
|
|
143
143
|
|
|
144
144
|
## 7. Logs ([D-0047](https://git.nyx-zone.com/dokebi/framework/-/blob/main/docs/decisions/D-0047-logging-and-no-silent-errors.md))
|
|
145
145
|
|
|
146
|
-
- Exceptions are never dropped silently. Failures other than those turned into close codes or error replies are `error`: a fixed English message + `code` + `error` (the full original error: name, whole message, stack and `Caused by: …` for each cause, address, port and errno text included; only URL credentials masked as `//***@`; cut only beyond 16 KB). Examples: handler failure `WebSocket message handler failed` (code from the error or `HANDLER_FAILED`, closed with 1011), socket error `SOCKET_ERROR`, broadcast write failure `BROADCAST_WRITE_FAILED`, presence handler `PRESENCE_HANDLER_FAILED`, lost hub events `HUB_EVENTS_FAILED` (every socket 1013), delayed cleanup `PRESENCE_CLEANUP_DEFERRED`. Registration failures are warn (closed with 4409 or 1013), slow consumers warn `SLOW_CONSUMER`. A reply or presence that could not be written to an already closed socket is warn `REPLY_DROPPED` (the client simply left; not a server failure; once per 10 seconds + `repeated`).
|
|
146
|
+
- Exceptions are never dropped silently. Failures other than those turned into close codes or error replies are `error`: a fixed English message + `code` + `error` (the full original error: name, whole message, stack and `Caused by: …` for each cause, address, port and errno text included; only URL credentials masked as `//***@`; cut only beyond 16 KB). Examples: handler failure `WebSocket message handler failed` (code from the error or `HANDLER_FAILED`, closed with 1011), socket error `SOCKET_ERROR`, broadcast write failure `BROADCAST_WRITE_FAILED`, presence handler `PRESENCE_HANDLER_FAILED`, lost hub events `HUB_EVENTS_FAILED` (every socket 1013), delayed cleanup `PRESENCE_CLEANUP_DEFERRED`. Registration failures are warn (closed with 4409 or 1013), slow consumers warn `SLOW_CONSUMER`. A reply or presence that could not be written to an already closed socket is warn `REPLY_DROPPED` (the client simply left; not a server failure; once per 10 seconds + `repeated`). That holds for the connection's own socket: a route's `message` that rejects with the `SOCKET_CLOSED` or `SLOW_CONSUMER` of a `send` to another connection (a relay awaiting a peer's `send`) while its own socket is open is a handler failure like any other (error, closed with 1011); catch it in `message` when a peer that left is expected (a `defineSocket` handler answers an error frame instead, as for every failure).
|
|
147
147
|
- Places that run per message or socket write the same message and code once per `logRepeatWindowMs` (10 seconds) and group the rest as a `repeated` count (the remaining count is written at drain end too). Bodies and tokens are never logged.
|
|
148
148
|
- Sealing (§4a): a refused frame is warn `WebSocket sealed frame refused; closed` (code `SEAL_FRAME_REFUSED`, `reason`, `error`; one line per reason per `logRepeatWindowMs` + `repeated`), codec creation failure error `SEAL_CODEC_FAILED` (1011), broadcast seal failure error `SEAL_ENCODE_FAILED` (1011), hello send failure warn `SEAL_HELLO_FAILED`. debug: provider present (`WebSocket seal provider`), the decision per upgrade (`WebSocket seal decision`: path, sealed, offered), `WebSocket seal hello sent`, 4415 (`WebSocket seal required; closed`), `sealed` on connection logs, the `sealed` count on broadcast logs.
|
|
149
149
|
- debug: route registration (`WebSocket route registered`: path, `routeId`, version), connect, close, refused upgrades (`WebSocket upgrade unauthorized` for a 401, `WebSocket upgrade refused; authorization expired` for a 401 of an invalid lease, `WebSocket origin refused` for a 403, `WebSocket upgrade refused` for a 503; each with `path` and `routeId`, the route's `config.id` or null, D-0140), hub registration ms, room join, leave and refusal, presence changes (counts), kick, broadcast delivery (ID, connection count, `binary`; after checking `isEnabled`), ignored `ack-v1` from old clients (`ACK_IGNORED`, one line per 10 seconds + `repeated`), idle and heartbeat closes, drain start and end. Too many waiting messages (1013 `Too many messages`) is warn `TOO_MANY_MESSAGES`; presence changes merged behind a slow presence handler are warn `PRESENCE_MERGED` (once per 10 seconds + `repeated`).
|
package/dist/gateway.js
CHANGED
|
@@ -1028,10 +1028,16 @@ export class Gateway {
|
|
|
1028
1028
|
// failure. A slow consumer was logged where it was closed; a client that left is
|
|
1029
1029
|
// counted here as warn, once per interval: the client is gone, nothing on this
|
|
1030
1030
|
// server failed (OPS-002 soak: thousands of these hid the real cause at error).
|
|
1031
|
+
// Only when it is this connection's socket that is closing (every refusal of its own
|
|
1032
|
+
// send closed it first: closed, slow, revoked or failed). The same codes from a send
|
|
1033
|
+
// to another connection (a relay that awaits a peer's `send`) are a failure of this
|
|
1034
|
+
// handler: the branches below would otherwise leave this socket open with `failed`
|
|
1035
|
+
// set, taking and sending nothing more, with nothing logged (audit R9-g11-1).
|
|
1036
|
+
const own = socket.readyState !== OPEN;
|
|
1031
1037
|
const code = error?.code;
|
|
1032
|
-
if (code === 'SLOW_CONSUMER')
|
|
1038
|
+
if (own && code === 'SLOW_CONSUMER')
|
|
1033
1039
|
return;
|
|
1034
|
-
if (code === 'SOCKET_CLOSED') {
|
|
1040
|
+
if (own && code === 'SOCKET_CLOSED') {
|
|
1035
1041
|
this.#throttle.log('warn', 'WebSocket reply dropped; socket closed', 'REPLY_DROPPED', error, { connection: id });
|
|
1036
1042
|
return;
|
|
1037
1043
|
}
|
package/dist/index.js
CHANGED
|
@@ -59,7 +59,7 @@ class WebsocketRuntime {
|
|
|
59
59
|
/** Factory input: `{ app, options? }`. Options default to `app.config['dokebi-websocket']`. */
|
|
60
60
|
export const createPlugin = definePlugin({
|
|
61
61
|
name: 'dokebi-websocket',
|
|
62
|
-
version: '0.4.
|
|
62
|
+
version: '0.4.3',
|
|
63
63
|
core: '^0.4.2',
|
|
64
64
|
options,
|
|
65
65
|
contributes: [realtime],
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dokebi/websocket",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.3",
|
|
4
4
|
"description": "WebSocket routes on @dokebi/web with rooms and broadcast across servers through @dokebi/websocket-hub.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"dokebi",
|
|
@@ -49,8 +49,8 @@
|
|
|
49
49
|
"@dokebi/websocket-hub": "^0.4.0"
|
|
50
50
|
},
|
|
51
51
|
"devDependencies": {
|
|
52
|
-
"@dokebi/web": "0.4.
|
|
53
|
-
"@dokebi/websocket-hub": "0.4.
|
|
52
|
+
"@dokebi/web": "0.4.7",
|
|
53
|
+
"@dokebi/websocket-hub": "0.4.3"
|
|
54
54
|
},
|
|
55
55
|
"dokebi": {
|
|
56
56
|
"schemaVersion": 2,
|