@colyseus/bun-websockets 0.15.0-alpha.3 → 0.15.0-alpha.4
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/build/BunWebSockets.d.ts
CHANGED
|
@@ -1,24 +1,24 @@
|
|
|
1
1
|
/// <reference types="bun-types" />
|
|
2
2
|
/// <reference types="node" />
|
|
3
|
-
import Bun, {
|
|
3
|
+
import Bun, { ServerWebSocket, WebSocketHandler } from "bun";
|
|
4
4
|
import { Transport } from '@colyseus/core';
|
|
5
5
|
import { WebSocketWrapper } from './WebSocketClient';
|
|
6
|
+
import { Application, Request, Response } from "express";
|
|
6
7
|
export type TransportOptions = Partial<Omit<WebSocketHandler, "message" | "open" | "drain" | "close" | "ping" | "pong">>;
|
|
7
8
|
interface WebSocketData {
|
|
8
9
|
url: URL;
|
|
9
10
|
}
|
|
10
11
|
export declare class BunWebSockets extends Transport {
|
|
11
12
|
private options;
|
|
12
|
-
|
|
13
|
+
expressApp: Application;
|
|
13
14
|
protected clients: ServerWebSocket<WebSocketData>[];
|
|
14
15
|
protected clientWrappers: WeakMap<Bun.ServerWebSocket<WebSocketData>, WebSocketWrapper>;
|
|
16
|
+
private _listening;
|
|
15
17
|
constructor(options?: TransportOptions);
|
|
16
|
-
listen(port: number
|
|
18
|
+
listen(port: number, hostname?: string, backlog?: number, listeningListener?: () => void): this;
|
|
17
19
|
shutdown(): void;
|
|
18
20
|
simulateLatency(milliseconds: number): void;
|
|
19
21
|
protected onConnection(rawClient: ServerWebSocket<WebSocketData>): Promise<void>;
|
|
20
|
-
protected handleMatchMakeRequest(req: Request,
|
|
21
|
-
[key: string]: string;
|
|
22
|
-
}]>;
|
|
22
|
+
protected handleMatchMakeRequest(req: Request, res: Response): Promise<void>;
|
|
23
23
|
}
|
|
24
24
|
export {};
|
package/build/BunWebSockets.js
CHANGED
|
@@ -27,52 +27,15 @@ __export(BunWebSockets_exports, {
|
|
|
27
27
|
});
|
|
28
28
|
module.exports = __toCommonJS(BunWebSockets_exports);
|
|
29
29
|
var import_bun = __toESM(require("bun"));
|
|
30
|
+
var import_bun_serve_express = __toESM(require("bun-serve-express"));
|
|
30
31
|
var import_core = require("@colyseus/core");
|
|
31
32
|
var import_WebSocketClient = require("./WebSocketClient");
|
|
32
33
|
class BunWebSockets extends import_core.Transport {
|
|
33
34
|
constructor(options = {}) {
|
|
34
35
|
super();
|
|
35
36
|
this.options = options;
|
|
36
|
-
if (!this.server) {
|
|
37
|
-
this.server = new import_core.DummyServer();
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
bunServer;
|
|
41
|
-
clients = [];
|
|
42
|
-
clientWrappers = /* @__PURE__ */ new WeakMap();
|
|
43
|
-
listen(port, hostname, backlog, listeningListener) {
|
|
44
37
|
const self = this;
|
|
45
|
-
this.
|
|
46
|
-
port,
|
|
47
|
-
hostname,
|
|
48
|
-
async fetch(req, server) {
|
|
49
|
-
const url = new URL(req.url);
|
|
50
|
-
if (url.pathname.startsWith(`/${import_core.matchMaker.controller.matchmakeRoute}`)) {
|
|
51
|
-
try {
|
|
52
|
-
const [code, response, headers] = await self.handleMatchMakeRequest(req, server, url);
|
|
53
|
-
return new Response(response, {
|
|
54
|
-
status: code,
|
|
55
|
-
headers: Object.assign(
|
|
56
|
-
headers,
|
|
57
|
-
import_core.matchMaker.controller.DEFAULT_CORS_HEADERS,
|
|
58
|
-
import_core.matchMaker.controller.getCorsHeaders.call(void 0, req)
|
|
59
|
-
)
|
|
60
|
-
});
|
|
61
|
-
} catch (e) {
|
|
62
|
-
return new Response(JSON.stringify({ code: e.code, error: e.message }), {
|
|
63
|
-
status: e.code || import_core.ErrorCode.MATCHMAKE_UNHANDLED,
|
|
64
|
-
headers: Object.assign(
|
|
65
|
-
{ "Content-Type": "application/json" },
|
|
66
|
-
import_core.matchMaker.controller.DEFAULT_CORS_HEADERS,
|
|
67
|
-
import_core.matchMaker.controller.getCorsHeaders.call(void 0, req)
|
|
68
|
-
)
|
|
69
|
-
});
|
|
70
|
-
}
|
|
71
|
-
} else {
|
|
72
|
-
server.upgrade(req, { data: { url } });
|
|
73
|
-
return void 0;
|
|
74
|
-
}
|
|
75
|
-
},
|
|
38
|
+
this.expressApp = (0, import_bun_serve_express.default)({
|
|
76
39
|
websocket: {
|
|
77
40
|
...this.options,
|
|
78
41
|
async open(ws) {
|
|
@@ -91,13 +54,32 @@ class BunWebSockets extends import_core.Transport {
|
|
|
91
54
|
}
|
|
92
55
|
}
|
|
93
56
|
});
|
|
94
|
-
|
|
57
|
+
if (!this.server) {
|
|
58
|
+
this.server = new import_core.DummyServer();
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
expressApp;
|
|
62
|
+
clients = [];
|
|
63
|
+
clientWrappers = /* @__PURE__ */ new WeakMap();
|
|
64
|
+
_listening;
|
|
65
|
+
listen(port, hostname, backlog, listeningListener) {
|
|
66
|
+
this._listening = this.expressApp.listen(port, listeningListener);
|
|
67
|
+
this.expressApp.use(`/${import_core.matchMaker.controller.matchmakeRoute}`, async (req, res) => {
|
|
68
|
+
try {
|
|
69
|
+
await this.handleMatchMakeRequest(req, res);
|
|
70
|
+
} catch (e) {
|
|
71
|
+
res.status(e.code || import_core.ErrorCode.MATCHMAKE_UNHANDLED).json({
|
|
72
|
+
code: e.code,
|
|
73
|
+
error: e.message
|
|
74
|
+
});
|
|
75
|
+
}
|
|
76
|
+
});
|
|
95
77
|
this.server.emit("listening");
|
|
96
78
|
return this;
|
|
97
79
|
}
|
|
98
80
|
shutdown() {
|
|
99
|
-
if (this.
|
|
100
|
-
this.
|
|
81
|
+
if (this._listening) {
|
|
82
|
+
this._listening.close();
|
|
101
83
|
this.server.emit("close");
|
|
102
84
|
}
|
|
103
85
|
}
|
|
@@ -127,43 +109,45 @@ class BunWebSockets extends import_core.Transport {
|
|
|
127
109
|
client.error(e.code, e.message, () => rawClient.close());
|
|
128
110
|
}
|
|
129
111
|
}
|
|
130
|
-
async handleMatchMakeRequest(req,
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
{
|
|
141
|
-
"Content-Type": "application/json"
|
|
142
|
-
}
|
|
143
|
-
];
|
|
144
|
-
}
|
|
145
|
-
case "POST": {
|
|
146
|
-
if (import_core.matchMaker.isGracefullyShuttingDown) {
|
|
147
|
-
throw new import_core.ServerError(503, "server is shutting down");
|
|
112
|
+
async handleMatchMakeRequest(req, res) {
|
|
113
|
+
try {
|
|
114
|
+
switch (req.method) {
|
|
115
|
+
case "OPTIONS": {
|
|
116
|
+
res.set(Object.assign(
|
|
117
|
+
{},
|
|
118
|
+
import_core.matchMaker.controller.DEFAULT_CORS_HEADERS,
|
|
119
|
+
import_core.matchMaker.controller.getCorsHeaders.call(void 0, req)
|
|
120
|
+
));
|
|
121
|
+
res.status(200).end();
|
|
148
122
|
}
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
throw new Error("invalid JSON input");
|
|
123
|
+
case "GET": {
|
|
124
|
+
const matchedParams = req.path.match(import_core.matchMaker.controller.allowedRoomNameChars);
|
|
125
|
+
const roomName = matchedParams.length > 1 ? matchedParams[matchedParams.length - 1] : "";
|
|
126
|
+
res.json(await import_core.matchMaker.controller.getAvailableRooms(roomName || ""));
|
|
154
127
|
}
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
200,
|
|
159
|
-
JSON.stringify(await import_core.matchMaker.controller.invokeMethod(method, roomName, clientOptions)),
|
|
160
|
-
{
|
|
161
|
-
"Content-Type": "application/json"
|
|
128
|
+
case "POST": {
|
|
129
|
+
if (import_core.matchMaker.isGracefullyShuttingDown) {
|
|
130
|
+
throw new import_core.ServerError(503, "server is shutting down");
|
|
162
131
|
}
|
|
163
|
-
|
|
132
|
+
const matchedParams = req.path.match(import_core.matchMaker.controller.allowedRoomNameChars);
|
|
133
|
+
const matchmakeIndex = matchedParams.indexOf(import_core.matchMaker.controller.matchmakeRoute);
|
|
134
|
+
const clientOptions = import_bun.default.readableStreamToJSON(req.body);
|
|
135
|
+
if (clientOptions === void 0) {
|
|
136
|
+
throw new Error("invalid JSON input");
|
|
137
|
+
}
|
|
138
|
+
const method = matchedParams[matchmakeIndex + 1];
|
|
139
|
+
const roomName = matchedParams[matchmakeIndex + 2] || "";
|
|
140
|
+
res.json(await import_core.matchMaker.controller.invokeMethod(method, roomName, clientOptions));
|
|
141
|
+
}
|
|
142
|
+
default:
|
|
143
|
+
throw new Error("invalid request method");
|
|
164
144
|
}
|
|
165
|
-
|
|
166
|
-
|
|
145
|
+
} catch (e) {
|
|
146
|
+
res.set(Object.assign(
|
|
147
|
+
{},
|
|
148
|
+
import_core.matchMaker.controller.DEFAULT_CORS_HEADERS,
|
|
149
|
+
import_core.matchMaker.controller.getCorsHeaders.call(void 0, req)
|
|
150
|
+
)).status(e.code || import_core.ErrorCode.MATCHMAKE_UNHANDLED).json({ code: e.code, error: e.message });
|
|
167
151
|
}
|
|
168
152
|
}
|
|
169
153
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../src/BunWebSockets.ts"],
|
|
4
|
-
"sourcesContent": ["/// <reference types=\"bun-types\" />\nimport Bun, { Server, ServerWebSocket, WebSocketHandler } from \"bun\";\n\nimport http from 'http';\n\nimport { DummyServer, ErrorCode, matchMaker, Transport, debugAndPrintError, spliceOne, ServerError } from '@colyseus/core';\nimport { WebSocketClient, WebSocketWrapper } from './WebSocketClient';\n\nexport type TransportOptions = Partial<Omit<WebSocketHandler, \"message\" | \"open\" | \"drain\" | \"close\" | \"ping\" | \"pong\">>;\n\ninterface WebSocketData {\n url: URL;\n // query: string,\n // headers: { [key: string]: string },\n // connection: { remoteAddress: string },\n}\n\nexport class BunWebSockets extends Transport {\n public
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AACA,iBAA+D;
|
|
6
|
-
"names": ["Bun"]
|
|
4
|
+
"sourcesContent": ["/// <reference types=\"bun-types\" />\nimport Bun, { Server, ServerWebSocket, WebSocketHandler } from \"bun\";\n\nimport http from 'http';\nimport bunExpress from \"bun-serve-express\";\n\nimport { DummyServer, ErrorCode, matchMaker, Transport, debugAndPrintError, spliceOne, ServerError } from '@colyseus/core';\nimport { WebSocketClient, WebSocketWrapper } from './WebSocketClient';\nimport { Application, Request, Response } from \"express\";\n\nexport type TransportOptions = Partial<Omit<WebSocketHandler, \"message\" | \"open\" | \"drain\" | \"close\" | \"ping\" | \"pong\">>;\n\ninterface WebSocketData {\n url: URL;\n // query: string,\n // headers: { [key: string]: string },\n // connection: { remoteAddress: string },\n}\n\nexport class BunWebSockets extends Transport {\n public expressApp: Application;\n\n protected clients: ServerWebSocket<WebSocketData>[] = [];\n protected clientWrappers = new WeakMap<ServerWebSocket<WebSocketData>, WebSocketWrapper>();\n\n private _listening: any;\n\n constructor(private options: TransportOptions = {}) {\n super();\n\n const self = this;\n\n this.expressApp = bunExpress({\n websocket: {\n ...this.options,\n\n async open(ws) {\n await self.onConnection(ws);\n },\n\n message(ws, message) {\n // this.clientWrappers.get(ws)?.emit('message', Buffer.from(message.slice(0)));\n self.clientWrappers.get(ws)?.emit('message', message);\n },\n\n close(ws, code, reason) {\n // remove from client list\n spliceOne(self.clients, self.clients.indexOf(ws));\n\n const clientWrapper = self.clientWrappers.get(ws);\n if (clientWrapper) {\n self.clientWrappers.delete(ws);\n\n // emit 'close' on wrapper\n clientWrapper.emit('close', code);\n }\n },\n }\n });\n\n // Adding a mock object for Transport.server\n if (!this.server) {\n this.server = new DummyServer();\n }\n }\n\n public listen(port: number, hostname?: string, backlog?: number, listeningListener?: () => void) {\n this._listening = this.expressApp.listen(port, listeningListener);\n\n this.expressApp.use(`/${matchMaker.controller.matchmakeRoute}`, async (req, res) => {\n try {\n await this.handleMatchMakeRequest(req, res);\n } catch (e) {\n res.status(e.code || ErrorCode.MATCHMAKE_UNHANDLED).json({\n code: e.code,\n error: e.message\n });\n }\n });\n\n // Mocking Transport.server behaviour, https://github.com/colyseus/colyseus/issues/458\n // @ts-ignore\n this.server.emit(\"listening\");\n\n return this;\n }\n\n public shutdown() {\n if (this._listening) {\n this._listening.close();\n\n // @ts-ignore\n this.server.emit(\"close\"); // Mocking Transport.server behaviour, https://github.com/colyseus/colyseus/issues/458\n }\n }\n\n public simulateLatency(milliseconds: number) {\n const originalRawSend = WebSocketClient.prototype.raw;\n WebSocketClient.prototype.raw = function () {\n setTimeout(() => originalRawSend.apply(this, arguments), milliseconds);\n }\n }\n\n protected async onConnection(rawClient: ServerWebSocket<WebSocketData>) {\n const wrapper = new WebSocketWrapper(rawClient);\n // keep reference to client and its wrapper\n this.clients.push(rawClient);\n this.clientWrappers.set(rawClient, wrapper);\n\n const parsedURL = new URL(rawClient.data.url);\n\n const sessionId = parsedURL.searchParams.get(\"sessionId\");\n const processAndRoomId = parsedURL.pathname.match(/\\/[a-zA-Z0-9_\\-]+\\/([a-zA-Z0-9_\\-]+)$/);\n const roomId = processAndRoomId && processAndRoomId[1];\n\n const room = matchMaker.getRoomById(roomId);\n const client = new WebSocketClient(sessionId, wrapper);\n\n //\n // TODO: DRY code below with all transports\n //\n\n try {\n if (!room || !room.hasReservedSeat(sessionId, parsedURL.searchParams.get(\"reconnectionToken\") as string)) {\n throw new Error('seat reservation expired.');\n }\n\n await room._onJoin(client, rawClient as unknown as http.IncomingMessage);\n\n } catch (e) {\n debugAndPrintError(e);\n\n // send error code to client then terminate\n client.error(e.code, e.message, () => rawClient.close());\n }\n }\n\n protected async handleMatchMakeRequest (req: Request, res: Response) {\n try {\n switch (req.method) {\n case 'OPTIONS': {\n res.set(Object.assign(\n {},\n matchMaker.controller.DEFAULT_CORS_HEADERS,\n matchMaker.controller.getCorsHeaders.call(undefined, req)\n ));\n res.status(200).end();\n }\n\n case 'GET': {\n const matchedParams = req.path.match(matchMaker.controller.allowedRoomNameChars);\n const roomName = matchedParams.length > 1 ? matchedParams[matchedParams.length - 1] : \"\";\n res.json(await matchMaker.controller.getAvailableRooms(roomName || ''));\n }\n\n case 'POST': {\n // do not accept matchmaking requests if already shutting down\n if (matchMaker.isGracefullyShuttingDown) {\n throw new ServerError(503, \"server is shutting down\");\n }\n\n const matchedParams = req.path.match(matchMaker.controller.allowedRoomNameChars);\n const matchmakeIndex = matchedParams.indexOf(matchMaker.controller.matchmakeRoute);\n const clientOptions = Bun.readableStreamToJSON(req.body);\n\n if (clientOptions === undefined) {\n throw new Error(\"invalid JSON input\");\n }\n\n const method = matchedParams[matchmakeIndex + 1];\n const roomName = matchedParams[matchmakeIndex + 2] || '';\n res.json(await matchMaker.controller.invokeMethod(method, roomName, clientOptions));\n }\n\n default: throw new Error(\"invalid request method\");\n }\n\n } catch (e) {\n res\n .set(Object.assign(\n {},\n matchMaker.controller.DEFAULT_CORS_HEADERS,\n matchMaker.controller.getCorsHeaders.call(undefined, req)\n ))\n .status(e.code || ErrorCode.MATCHMAKE_UNHANDLED)\n .json({ code: e.code, error: e.message });\n }\n\n }\n\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AACA,iBAA+D;AAG/D,+BAAuB;AAEvB,kBAA0G;AAC1G,6BAAkD;AAY3C,MAAM,sBAAsB,sBAAU;AAAA,EAQ3C,YAAoB,UAA4B,CAAC,GAAG;AAClD,UAAM;AADY;AAGlB,UAAM,OAAO;AAEb,SAAK,iBAAa,yBAAAA,SAAW;AAAA,MAC3B,WAAW;AAAA,QACT,GAAG,KAAK;AAAA,QAER,MAAM,KAAK,IAAI;AACb,gBAAM,KAAK,aAAa,EAAE;AAAA,QAC5B;AAAA,QAEA,QAAQ,IAAI,SAAS;AAEnB,eAAK,eAAe,IAAI,EAAE,GAAG,KAAK,WAAW,OAAO;AAAA,QACtD;AAAA,QAEA,MAAM,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BAAyB;AAAA,UACtD;AAEA,gBAAM,gBAAgB,IAAI,KAAK,MAAM,uBAAW,WAAW,oBAAoB;AAC/E,gBAAM,iBAAiB,cAAc,QAAQ,uBAAW,WAAW,cAAc;AACjF,gBAAM,gBAAgB,WAAAC,QAAI,qBAAqB,IAAI,IAAI;AAEvD,cAAI,kBAAkB,QAAW;AAC/B,kBAAM,IAAI,MAAM,oBAAoB;AAAA,UACtC;AAEA,gBAAM,SAAS,cAAc,iBAAiB;AAC9C,gBAAM,WAAW,cAAc,iBAAiB,MAAM;AACtD,cAAI,KAAK,MAAM,uBAAW,WAAW,aAAa,QAAQ,UAAU,aAAa,CAAC;AAAA,QACpF;AAAA;AAES,gBAAM,IAAI,MAAM,wBAAwB;AAAA;AAAA,IAGrD,SAAS,GAAP;AACA,UACG,IAAI,OAAO;AAAA,QACV,CAAC;AAAA,QACD,uBAAW,WAAW;AAAA,QACtB,uBAAW,WAAW,eAAe,KAAK,QAAW,GAAG;AAAA,MAC1D,CAAC,EACA,OAAO,EAAE,QAAQ,sBAAU,mBAAmB,EAC9C,KAAK,EAAE,MAAM,EAAE,MAAM,OAAO,EAAE,QAAQ,CAAC;AAAA,IAC5C;AAAA,EAEF;AAEF;",
|
|
6
|
+
"names": ["bunExpress", "Bun"]
|
|
7
7
|
}
|
package/build/BunWebSockets.mjs
CHANGED
|
@@ -1,50 +1,13 @@
|
|
|
1
1
|
import Bun from "bun";
|
|
2
|
+
import bunExpress from "bun-serve-express";
|
|
2
3
|
import { DummyServer, ErrorCode, matchMaker, Transport, debugAndPrintError, spliceOne, ServerError } from "@colyseus/core";
|
|
3
4
|
import { WebSocketClient, WebSocketWrapper } from "./WebSocketClient";
|
|
4
5
|
class BunWebSockets extends Transport {
|
|
5
6
|
constructor(options = {}) {
|
|
6
7
|
super();
|
|
7
8
|
this.options = options;
|
|
8
|
-
if (!this.server) {
|
|
9
|
-
this.server = new DummyServer();
|
|
10
|
-
}
|
|
11
|
-
}
|
|
12
|
-
bunServer;
|
|
13
|
-
clients = [];
|
|
14
|
-
clientWrappers = /* @__PURE__ */ new WeakMap();
|
|
15
|
-
listen(port, hostname, backlog, listeningListener) {
|
|
16
9
|
const self = this;
|
|
17
|
-
this.
|
|
18
|
-
port,
|
|
19
|
-
hostname,
|
|
20
|
-
async fetch(req, server) {
|
|
21
|
-
const url = new URL(req.url);
|
|
22
|
-
if (url.pathname.startsWith(`/${matchMaker.controller.matchmakeRoute}`)) {
|
|
23
|
-
try {
|
|
24
|
-
const [code, response, headers] = await self.handleMatchMakeRequest(req, server, url);
|
|
25
|
-
return new Response(response, {
|
|
26
|
-
status: code,
|
|
27
|
-
headers: Object.assign(
|
|
28
|
-
headers,
|
|
29
|
-
matchMaker.controller.DEFAULT_CORS_HEADERS,
|
|
30
|
-
matchMaker.controller.getCorsHeaders.call(void 0, req)
|
|
31
|
-
)
|
|
32
|
-
});
|
|
33
|
-
} catch (e) {
|
|
34
|
-
return new Response(JSON.stringify({ code: e.code, error: e.message }), {
|
|
35
|
-
status: e.code || ErrorCode.MATCHMAKE_UNHANDLED,
|
|
36
|
-
headers: Object.assign(
|
|
37
|
-
{ "Content-Type": "application/json" },
|
|
38
|
-
matchMaker.controller.DEFAULT_CORS_HEADERS,
|
|
39
|
-
matchMaker.controller.getCorsHeaders.call(void 0, req)
|
|
40
|
-
)
|
|
41
|
-
});
|
|
42
|
-
}
|
|
43
|
-
} else {
|
|
44
|
-
server.upgrade(req, { data: { url } });
|
|
45
|
-
return void 0;
|
|
46
|
-
}
|
|
47
|
-
},
|
|
10
|
+
this.expressApp = bunExpress({
|
|
48
11
|
websocket: {
|
|
49
12
|
...this.options,
|
|
50
13
|
async open(ws) {
|
|
@@ -63,13 +26,32 @@ class BunWebSockets extends Transport {
|
|
|
63
26
|
}
|
|
64
27
|
}
|
|
65
28
|
});
|
|
66
|
-
|
|
29
|
+
if (!this.server) {
|
|
30
|
+
this.server = new DummyServer();
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
expressApp;
|
|
34
|
+
clients = [];
|
|
35
|
+
clientWrappers = /* @__PURE__ */ new WeakMap();
|
|
36
|
+
_listening;
|
|
37
|
+
listen(port, hostname, backlog, listeningListener) {
|
|
38
|
+
this._listening = this.expressApp.listen(port, listeningListener);
|
|
39
|
+
this.expressApp.use(`/${matchMaker.controller.matchmakeRoute}`, async (req, res) => {
|
|
40
|
+
try {
|
|
41
|
+
await this.handleMatchMakeRequest(req, res);
|
|
42
|
+
} catch (e) {
|
|
43
|
+
res.status(e.code || ErrorCode.MATCHMAKE_UNHANDLED).json({
|
|
44
|
+
code: e.code,
|
|
45
|
+
error: e.message
|
|
46
|
+
});
|
|
47
|
+
}
|
|
48
|
+
});
|
|
67
49
|
this.server.emit("listening");
|
|
68
50
|
return this;
|
|
69
51
|
}
|
|
70
52
|
shutdown() {
|
|
71
|
-
if (this.
|
|
72
|
-
this.
|
|
53
|
+
if (this._listening) {
|
|
54
|
+
this._listening.close();
|
|
73
55
|
this.server.emit("close");
|
|
74
56
|
}
|
|
75
57
|
}
|
|
@@ -99,43 +81,45 @@ class BunWebSockets extends Transport {
|
|
|
99
81
|
client.error(e.code, e.message, () => rawClient.close());
|
|
100
82
|
}
|
|
101
83
|
}
|
|
102
|
-
async handleMatchMakeRequest(req,
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
{
|
|
113
|
-
"Content-Type": "application/json"
|
|
114
|
-
}
|
|
115
|
-
];
|
|
116
|
-
}
|
|
117
|
-
case "POST": {
|
|
118
|
-
if (matchMaker.isGracefullyShuttingDown) {
|
|
119
|
-
throw new ServerError(503, "server is shutting down");
|
|
84
|
+
async handleMatchMakeRequest(req, res) {
|
|
85
|
+
try {
|
|
86
|
+
switch (req.method) {
|
|
87
|
+
case "OPTIONS": {
|
|
88
|
+
res.set(Object.assign(
|
|
89
|
+
{},
|
|
90
|
+
matchMaker.controller.DEFAULT_CORS_HEADERS,
|
|
91
|
+
matchMaker.controller.getCorsHeaders.call(void 0, req)
|
|
92
|
+
));
|
|
93
|
+
res.status(200).end();
|
|
120
94
|
}
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
throw new Error("invalid JSON input");
|
|
95
|
+
case "GET": {
|
|
96
|
+
const matchedParams = req.path.match(matchMaker.controller.allowedRoomNameChars);
|
|
97
|
+
const roomName = matchedParams.length > 1 ? matchedParams[matchedParams.length - 1] : "";
|
|
98
|
+
res.json(await matchMaker.controller.getAvailableRooms(roomName || ""));
|
|
126
99
|
}
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
200,
|
|
131
|
-
JSON.stringify(await matchMaker.controller.invokeMethod(method, roomName, clientOptions)),
|
|
132
|
-
{
|
|
133
|
-
"Content-Type": "application/json"
|
|
100
|
+
case "POST": {
|
|
101
|
+
if (matchMaker.isGracefullyShuttingDown) {
|
|
102
|
+
throw new ServerError(503, "server is shutting down");
|
|
134
103
|
}
|
|
135
|
-
|
|
104
|
+
const matchedParams = req.path.match(matchMaker.controller.allowedRoomNameChars);
|
|
105
|
+
const matchmakeIndex = matchedParams.indexOf(matchMaker.controller.matchmakeRoute);
|
|
106
|
+
const clientOptions = Bun.readableStreamToJSON(req.body);
|
|
107
|
+
if (clientOptions === void 0) {
|
|
108
|
+
throw new Error("invalid JSON input");
|
|
109
|
+
}
|
|
110
|
+
const method = matchedParams[matchmakeIndex + 1];
|
|
111
|
+
const roomName = matchedParams[matchmakeIndex + 2] || "";
|
|
112
|
+
res.json(await matchMaker.controller.invokeMethod(method, roomName, clientOptions));
|
|
113
|
+
}
|
|
114
|
+
default:
|
|
115
|
+
throw new Error("invalid request method");
|
|
136
116
|
}
|
|
137
|
-
|
|
138
|
-
|
|
117
|
+
} catch (e) {
|
|
118
|
+
res.set(Object.assign(
|
|
119
|
+
{},
|
|
120
|
+
matchMaker.controller.DEFAULT_CORS_HEADERS,
|
|
121
|
+
matchMaker.controller.getCorsHeaders.call(void 0, req)
|
|
122
|
+
)).status(e.code || ErrorCode.MATCHMAKE_UNHANDLED).json({ code: e.code, error: e.message });
|
|
139
123
|
}
|
|
140
124
|
}
|
|
141
125
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../src/BunWebSockets.ts"],
|
|
4
|
-
"sourcesContent": ["/// <reference types=\"bun-types\" />\nimport Bun, { Server, ServerWebSocket, WebSocketHandler } from \"bun\";\n\nimport http from 'http';\n\nimport { DummyServer, ErrorCode, matchMaker, Transport, debugAndPrintError, spliceOne, ServerError } from '@colyseus/core';\nimport { WebSocketClient, WebSocketWrapper } from './WebSocketClient';\n\nexport type TransportOptions = Partial<Omit<WebSocketHandler, \"message\" | \"open\" | \"drain\" | \"close\" | \"ping\" | \"pong\">>;\n\ninterface WebSocketData {\n url: URL;\n // query: string,\n // headers: { [key: string]: string },\n // connection: { remoteAddress: string },\n}\n\nexport class BunWebSockets extends Transport {\n public
|
|
5
|
-
"mappings": "AACA,OAAO,SAAwD;
|
|
4
|
+
"sourcesContent": ["/// <reference types=\"bun-types\" />\nimport Bun, { Server, ServerWebSocket, WebSocketHandler } from \"bun\";\n\nimport http from 'http';\nimport bunExpress from \"bun-serve-express\";\n\nimport { DummyServer, ErrorCode, matchMaker, Transport, debugAndPrintError, spliceOne, ServerError } from '@colyseus/core';\nimport { WebSocketClient, WebSocketWrapper } from './WebSocketClient';\nimport { Application, Request, Response } from \"express\";\n\nexport type TransportOptions = Partial<Omit<WebSocketHandler, \"message\" | \"open\" | \"drain\" | \"close\" | \"ping\" | \"pong\">>;\n\ninterface WebSocketData {\n url: URL;\n // query: string,\n // headers: { [key: string]: string },\n // connection: { remoteAddress: string },\n}\n\nexport class BunWebSockets extends Transport {\n public expressApp: Application;\n\n protected clients: ServerWebSocket<WebSocketData>[] = [];\n protected clientWrappers = new WeakMap<ServerWebSocket<WebSocketData>, WebSocketWrapper>();\n\n private _listening: any;\n\n constructor(private options: TransportOptions = {}) {\n super();\n\n const self = this;\n\n this.expressApp = bunExpress({\n websocket: {\n ...this.options,\n\n async open(ws) {\n await self.onConnection(ws);\n },\n\n message(ws, message) {\n // this.clientWrappers.get(ws)?.emit('message', Buffer.from(message.slice(0)));\n self.clientWrappers.get(ws)?.emit('message', message);\n },\n\n close(ws, code, reason) {\n // remove from client list\n spliceOne(self.clients, self.clients.indexOf(ws));\n\n const clientWrapper = self.clientWrappers.get(ws);\n if (clientWrapper) {\n self.clientWrappers.delete(ws);\n\n // emit 'close' on wrapper\n clientWrapper.emit('close', code);\n }\n },\n }\n });\n\n // Adding a mock object for Transport.server\n if (!this.server) {\n this.server = new DummyServer();\n }\n }\n\n public listen(port: number, hostname?: string, backlog?: number, listeningListener?: () => void) {\n this._listening = this.expressApp.listen(port, listeningListener);\n\n this.expressApp.use(`/${matchMaker.controller.matchmakeRoute}`, async (req, res) => {\n try {\n await this.handleMatchMakeRequest(req, res);\n } catch (e) {\n res.status(e.code || ErrorCode.MATCHMAKE_UNHANDLED).json({\n code: e.code,\n error: e.message\n });\n }\n });\n\n // Mocking Transport.server behaviour, https://github.com/colyseus/colyseus/issues/458\n // @ts-ignore\n this.server.emit(\"listening\");\n\n return this;\n }\n\n public shutdown() {\n if (this._listening) {\n this._listening.close();\n\n // @ts-ignore\n this.server.emit(\"close\"); // Mocking Transport.server behaviour, https://github.com/colyseus/colyseus/issues/458\n }\n }\n\n public simulateLatency(milliseconds: number) {\n const originalRawSend = WebSocketClient.prototype.raw;\n WebSocketClient.prototype.raw = function () {\n setTimeout(() => originalRawSend.apply(this, arguments), milliseconds);\n }\n }\n\n protected async onConnection(rawClient: ServerWebSocket<WebSocketData>) {\n const wrapper = new WebSocketWrapper(rawClient);\n // keep reference to client and its wrapper\n this.clients.push(rawClient);\n this.clientWrappers.set(rawClient, wrapper);\n\n const parsedURL = new URL(rawClient.data.url);\n\n const sessionId = parsedURL.searchParams.get(\"sessionId\");\n const processAndRoomId = parsedURL.pathname.match(/\\/[a-zA-Z0-9_\\-]+\\/([a-zA-Z0-9_\\-]+)$/);\n const roomId = processAndRoomId && processAndRoomId[1];\n\n const room = matchMaker.getRoomById(roomId);\n const client = new WebSocketClient(sessionId, wrapper);\n\n //\n // TODO: DRY code below with all transports\n //\n\n try {\n if (!room || !room.hasReservedSeat(sessionId, parsedURL.searchParams.get(\"reconnectionToken\") as string)) {\n throw new Error('seat reservation expired.');\n }\n\n await room._onJoin(client, rawClient as unknown as http.IncomingMessage);\n\n } catch (e) {\n debugAndPrintError(e);\n\n // send error code to client then terminate\n client.error(e.code, e.message, () => rawClient.close());\n }\n }\n\n protected async handleMatchMakeRequest (req: Request, res: Response) {\n try {\n switch (req.method) {\n case 'OPTIONS': {\n res.set(Object.assign(\n {},\n matchMaker.controller.DEFAULT_CORS_HEADERS,\n matchMaker.controller.getCorsHeaders.call(undefined, req)\n ));\n res.status(200).end();\n }\n\n case 'GET': {\n const matchedParams = req.path.match(matchMaker.controller.allowedRoomNameChars);\n const roomName = matchedParams.length > 1 ? matchedParams[matchedParams.length - 1] : \"\";\n res.json(await matchMaker.controller.getAvailableRooms(roomName || ''));\n }\n\n case 'POST': {\n // do not accept matchmaking requests if already shutting down\n if (matchMaker.isGracefullyShuttingDown) {\n throw new ServerError(503, \"server is shutting down\");\n }\n\n const matchedParams = req.path.match(matchMaker.controller.allowedRoomNameChars);\n const matchmakeIndex = matchedParams.indexOf(matchMaker.controller.matchmakeRoute);\n const clientOptions = Bun.readableStreamToJSON(req.body);\n\n if (clientOptions === undefined) {\n throw new Error(\"invalid JSON input\");\n }\n\n const method = matchedParams[matchmakeIndex + 1];\n const roomName = matchedParams[matchmakeIndex + 2] || '';\n res.json(await matchMaker.controller.invokeMethod(method, roomName, clientOptions));\n }\n\n default: throw new Error(\"invalid request method\");\n }\n\n } catch (e) {\n res\n .set(Object.assign(\n {},\n matchMaker.controller.DEFAULT_CORS_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C,EACA,OAAO,EAAE,QAAQ,UAAU,mBAAmB,EAC9C,KAAK,EAAE,MAAM,EAAE,MAAM,OAAO,EAAE,QAAQ,CAAC;AAAA,IAC5C;AAAA,EAEF;AAEF;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
package/package.json
CHANGED
|
@@ -1,12 +1,14 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@colyseus/bun-websockets",
|
|
3
|
-
"version": "0.15.0-alpha.
|
|
3
|
+
"version": "0.15.0-alpha.4",
|
|
4
4
|
"input": "./src/index.ts",
|
|
5
5
|
"main": "./build/index.js",
|
|
6
6
|
"module": "./build/index.mjs",
|
|
7
7
|
"typings": "./build/index.d.ts",
|
|
8
8
|
"dependencies": {
|
|
9
|
-
"@colyseus/core": "^0.15.0"
|
|
9
|
+
"@colyseus/core": "^0.15.0",
|
|
10
|
+
"bun-serve-express": "^1.0.2",
|
|
11
|
+
"express": "^4.17.1"
|
|
10
12
|
},
|
|
11
13
|
"devDependencies": {
|
|
12
14
|
"bun-types": "^1.0.1"
|
|
@@ -35,5 +37,5 @@
|
|
|
35
37
|
"publishConfig": {
|
|
36
38
|
"access": "public"
|
|
37
39
|
},
|
|
38
|
-
"gitHead": "
|
|
40
|
+
"gitHead": "f0fa28420e24aae141be545ef4954d9f1627fdeb"
|
|
39
41
|
}
|