@wxn0brp/gloves-link-server 0.0.9 → 0.0.10
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 +6 -4
- package/dist/index.js +5 -8
- package/dist/types.d.ts +0 -1
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
import { WebSocketServer } from "ws";
|
|
2
|
-
import { Server_Opts } from "./types.js";
|
|
3
|
-
import { GLSocket } from "./socket.js";
|
|
4
1
|
import FalconFrame, { Router } from "@wxn0brp/falcon-frame";
|
|
5
|
-
import
|
|
2
|
+
import http from "http";
|
|
3
|
+
import { WebSocketServer } from "ws";
|
|
6
4
|
import { Namespace } from "./namespace.js";
|
|
5
|
+
import { Room, Rooms } from "./room.js";
|
|
6
|
+
import { GLSocket } from "./socket.js";
|
|
7
|
+
import { Server_Opts } from "./types.js";
|
|
7
8
|
/**
|
|
8
9
|
* GlovesLinkServer class provides a WebSocket server with namespace and room functionality
|
|
9
10
|
*/
|
|
@@ -22,6 +23,7 @@ export declare class GlovesLinkServer {
|
|
|
22
23
|
* @param opts - Server options including the HTTP server instance
|
|
23
24
|
*/
|
|
24
25
|
constructor(opts: Partial<Server_Opts>);
|
|
26
|
+
createServer(server: http.Server): void;
|
|
25
27
|
/**
|
|
26
28
|
* Saves the status of a socket connection for temporary tracking
|
|
27
29
|
* @param socketSelfId - The ID of the socket
|
package/dist/index.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { WebSocketServer } from "ws";
|
|
2
|
-
import { GLSocket } from "./socket.js";
|
|
3
1
|
import { Router } from "@wxn0brp/falcon-frame";
|
|
4
|
-
import {
|
|
2
|
+
import { WebSocketServer } from "ws";
|
|
5
3
|
import { Namespace } from "./namespace.js";
|
|
4
|
+
import { Room } from "./room.js";
|
|
5
|
+
import { GLSocket } from "./socket.js";
|
|
6
6
|
/**
|
|
7
7
|
* GlovesLinkServer class provides a WebSocket server with namespace and room functionality
|
|
8
8
|
*/
|
|
@@ -19,15 +19,12 @@ export class GlovesLinkServer {
|
|
|
19
19
|
*/
|
|
20
20
|
constructor(opts) {
|
|
21
21
|
this.opts = {
|
|
22
|
-
server: null,
|
|
23
22
|
logs: false,
|
|
24
23
|
...opts
|
|
25
24
|
};
|
|
26
|
-
if (!this.opts?.server) {
|
|
27
|
-
throw new Error("Server is not provided");
|
|
28
|
-
}
|
|
29
|
-
const { server } = opts;
|
|
30
25
|
this.wss = new WebSocketServer({ noServer: true });
|
|
26
|
+
}
|
|
27
|
+
createServer(server) {
|
|
31
28
|
server.on("upgrade", async (request, socket, head) => {
|
|
32
29
|
const headers = request.headers;
|
|
33
30
|
let socketSelfId;
|
package/dist/types.d.ts
CHANGED