chore(deps-dev): bump prettier from 2.1.2 to 2.8.8 (#5372)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Tom Moor <tom.moor@gmail.com>
This commit is contained in:
@@ -39,50 +39,49 @@ export default function init(
|
||||
],
|
||||
});
|
||||
|
||||
server.on("upgrade", function (
|
||||
req: IncomingMessage,
|
||||
socket: Duplex,
|
||||
head: Buffer
|
||||
) {
|
||||
if (req.url?.startsWith(path)) {
|
||||
// parse document id and close connection if not present in request
|
||||
const documentId = url
|
||||
.parse(req.url)
|
||||
.pathname?.replace(path, "")
|
||||
.split("/")
|
||||
.pop();
|
||||
server.on(
|
||||
"upgrade",
|
||||
function (req: IncomingMessage, socket: Duplex, head: Buffer) {
|
||||
if (req.url?.startsWith(path)) {
|
||||
// parse document id and close connection if not present in request
|
||||
const documentId = url
|
||||
.parse(req.url)
|
||||
.pathname?.replace(path, "")
|
||||
.split("/")
|
||||
.pop();
|
||||
|
||||
if (documentId) {
|
||||
wss.handleUpgrade(req, socket, head, (client) => {
|
||||
// Handle websocket connection errors as soon as the client is upgraded
|
||||
client.on("error", (error) => {
|
||||
Logger.error(
|
||||
`Websocket error`,
|
||||
error,
|
||||
{
|
||||
documentId,
|
||||
},
|
||||
req
|
||||
);
|
||||
if (documentId) {
|
||||
wss.handleUpgrade(req, socket, head, (client) => {
|
||||
// Handle websocket connection errors as soon as the client is upgraded
|
||||
client.on("error", (error) => {
|
||||
Logger.error(
|
||||
`Websocket error`,
|
||||
error,
|
||||
{
|
||||
documentId,
|
||||
},
|
||||
req
|
||||
);
|
||||
});
|
||||
|
||||
hocuspocus.handleConnection(client, req, documentId);
|
||||
});
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
hocuspocus.handleConnection(client, req, documentId);
|
||||
});
|
||||
if (
|
||||
req.url?.startsWith("/realtime") &&
|
||||
serviceNames.includes("websockets")
|
||||
) {
|
||||
// Nothing to do, the websockets service will handle this request
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if (
|
||||
req.url?.startsWith("/realtime") &&
|
||||
serviceNames.includes("websockets")
|
||||
) {
|
||||
// Nothing to do, the websockets service will handle this request
|
||||
return;
|
||||
// If the collaboration service is running it will close the connection
|
||||
socket.end(`HTTP/1.1 400 Bad Request\r\n`);
|
||||
}
|
||||
|
||||
// If the collaboration service is running it will close the connection
|
||||
socket.end(`HTTP/1.1 400 Bad Request\r\n`);
|
||||
});
|
||||
);
|
||||
|
||||
ShutdownHelper.add("collaboration", ShutdownOrder.normal, () =>
|
||||
hocuspocus.destroy()
|
||||
|
||||
@@ -53,25 +53,24 @@ export default function init(
|
||||
);
|
||||
}
|
||||
|
||||
server.on("upgrade", function (
|
||||
req: IncomingMessage,
|
||||
socket: Duplex,
|
||||
head: Buffer
|
||||
) {
|
||||
if (req.url?.startsWith(path)) {
|
||||
invariant(ioHandleUpgrade, "Existing upgrade handler must exist");
|
||||
ioHandleUpgrade(req, socket, head);
|
||||
return;
|
||||
}
|
||||
server.on(
|
||||
"upgrade",
|
||||
function (req: IncomingMessage, socket: Duplex, head: Buffer) {
|
||||
if (req.url?.startsWith(path)) {
|
||||
invariant(ioHandleUpgrade, "Existing upgrade handler must exist");
|
||||
ioHandleUpgrade(req, socket, head);
|
||||
return;
|
||||
}
|
||||
|
||||
if (serviceNames.includes("collaboration")) {
|
||||
// Nothing to do, the collaboration service will handle this request
|
||||
return;
|
||||
}
|
||||
if (serviceNames.includes("collaboration")) {
|
||||
// Nothing to do, the collaboration service will handle this request
|
||||
return;
|
||||
}
|
||||
|
||||
// If the collaboration service isn't running then we need to close the connection
|
||||
socket.end(`HTTP/1.1 400 Bad Request\r\n`);
|
||||
});
|
||||
// If the collaboration service isn't running then we need to close the connection
|
||||
socket.end(`HTTP/1.1 400 Bad Request\r\n`);
|
||||
}
|
||||
);
|
||||
|
||||
ShutdownHelper.add("websockets", ShutdownOrder.normal, async () => {
|
||||
Metrics.gaugePerInstance("websockets.count", 0);
|
||||
|
||||
Reference in New Issue
Block a user