mirror of
https://gitcode.com/gh_mirrors/hy/Hydro.git
synced 2026-10-20 01:38:19 +08:00
core: server: fix websocket message handle
This commit is contained in:
1 parent
8ba14111db
commit
4f4e6f9377
2 files changed
+5
-7
No files matched your search
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "hydrooj",
|
"name": "hydrooj",
|
||||||
"version": "3.12.0",
|
"version": "3.12.1",
|
||||||
"bin": "bin/hydrooj.js",
|
"bin": "bin/hydrooj.js",
|
||||||
"main": "src/loader",
|
"main": "src/loader",
|
||||||
"module": "src/loader",
|
"module": "src/loader",
|
||||||
|
|||||||
@@ -388,13 +388,11 @@ export function Connection(
|
|||||||
if (h._prepare) await h._prepare(args);
|
if (h._prepare) await h._prepare(args);
|
||||||
if (h.prepare) await h.prepare(args);
|
if (h.prepare) await h.prepare(args);
|
||||||
if (h.message) {
|
if (h.message) {
|
||||||
conn.on('data', (data) => {
|
conn.onmessage = (e) => {
|
||||||
h.message(JSON.parse(data));
|
h.message(JSON.parse(e.data.toString()));
|
||||||
});
|
};
|
||||||
}
|
}
|
||||||
conn.on('close', async () => {
|
conn.onclose = () => h.cleanup?.(args);
|
||||||
if (h.cleanup) await h.cleanup(args);
|
|
||||||
});
|
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
await h.onerror(e);
|
await h.onerror(e);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in new issue
Block a user