@tulipes/socket.io 0.1.0-rc.2 → 0.1.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/socket-manager.js
CHANGED
|
@@ -13,12 +13,14 @@ export class SocketManager {
|
|
|
13
13
|
#io;
|
|
14
14
|
/** namespace name → owning module */
|
|
15
15
|
#namespaces = new Map();
|
|
16
|
+
#attached = false;
|
|
16
17
|
constructor(options) {
|
|
17
18
|
this.#io = new Server(options);
|
|
18
19
|
}
|
|
19
20
|
/** Bind to the server that will accept the upgrades; once, before it listens. */
|
|
20
21
|
attach(httpServer) {
|
|
21
22
|
this.#io.attach(httpServer);
|
|
23
|
+
this.#attached = true;
|
|
22
24
|
}
|
|
23
25
|
/** Escape hatch for advanced use — prefer `of()` for claimed namespaces. */
|
|
24
26
|
get io() {
|
|
@@ -52,6 +54,12 @@ export class SocketManager {
|
|
|
52
54
|
* This also closes HTTP; boot starts and awaits HTTP draining alongside it.
|
|
53
55
|
*/
|
|
54
56
|
close() {
|
|
57
|
+
// Socket.IO's close() reaches into the engine that attach() creates. A boot
|
|
58
|
+
// that failed before the HTTP server existed still disposes this resource,
|
|
59
|
+
// and closing an unattached server would throw a TypeError on top of — and
|
|
60
|
+
// in place of — the failure that actually stopped the boot.
|
|
61
|
+
if (!this.#attached)
|
|
62
|
+
return Promise.resolve();
|
|
55
63
|
return new Promise((resolve) => {
|
|
56
64
|
this.#io.close(() => resolve());
|
|
57
65
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"socket-manager.js","sourceRoot":"","sources":["../src/socket-manager.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,EAAsC,MAAM,WAAW,CAAC;AAkBvE;;;;;;;;;GASG;AACH,MAAM,OAAO,aAAa;IACf,GAAG,CAAS;IACrB,qCAAqC;IAC5B,WAAW,GAAG,IAAI,GAAG,EAAkB,CAAC;
|
|
1
|
+
{"version":3,"file":"socket-manager.js","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QACvD,IAAI,KAAK,EAAE,CAAC;YACV,IAAI,CAAC,MAAM,CAAC,cAAc,IAAI,mCAAmC,KAAK,GAAG,CAAC,CAAC;YAC3E,OAAO,IAAI,CAAC;QACd,CAAC;QACD,KAAK,CAAC,IAAI,CAAC,QAAQ,CAAC,EAAE,CAAC,EAAE,CAAC,IAAI,CAAC,CAAC,CAAC;QACjC,OAAO,IAAI,CAAC;IACd,CAAC;IAED,MAAM,CAAC,OAAe;QACpB,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,IAAI,CAAC,OAAO,EAAE,OAAO,EAAE,CAAC,CAAC;IACrE,CAAC;CACF"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tulipes/socket.io",
|
|
3
|
-
"version": "0.1.0
|
|
3
|
+
"version": "0.1.0",
|
|
4
4
|
"description": "Socket.IO sockets provider for Tulipes apps: module-owned namespaces on the backend's HTTP server, behind core's sockets capability",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"exports": {
|
|
@@ -26,10 +26,10 @@
|
|
|
26
26
|
"socket.io": "^4"
|
|
27
27
|
},
|
|
28
28
|
"peerDependencies": {
|
|
29
|
-
"@tulipes/core": "^0.10.0
|
|
29
|
+
"@tulipes/core": "^0.10.0"
|
|
30
30
|
},
|
|
31
31
|
"devDependencies": {
|
|
32
|
-
"@tulipes/core": "0.10.0
|
|
32
|
+
"@tulipes/core": "0.10.0",
|
|
33
33
|
"@types/node": "^24.2.0",
|
|
34
34
|
"typescript": "^7.0.2"
|
|
35
35
|
},
|