fix: fastify needs register to be awaited, connection binaryType set to nodebuffer after hyper setup, and no http2

This commit is contained in:
Derrick Hammer 2023-07-04 00:52:35 -04:00
parent 7e17b477bd
commit d1c79acd72
Signed by: pcfreak30
GPG Key ID: C997C339BE476FF2
1 changed files with 2 additions and 2 deletions

View File

@ -19,14 +19,14 @@ export async function start() {
const dht = getSwarm(); const dht = getSwarm();
let relayServer = fastify({ let relayServer = fastify({
http2: true,
logger: log.child({ module: "relay-server" }), logger: log.child({ module: "relay-server" }),
}); });
relayServer.register(websocket); await relayServer.register(websocket);
relayServer.get("/", { websocket: true }, (connection) => { relayServer.get("/", { websocket: true }, (connection) => {
relay(dht, new Stream(false, connection.socket)); relay(dht, new Stream(false, connection.socket));
connection.socket.binaryType = "nodebuffer";
}); });
let port = config.uint("core.relayPort"); let port = config.uint("core.relayPort");