This commit is contained in:
bniwredyc 2023-03-30 03:22:00 +02:00
parent 44a0b3cd58
commit 38884ccbc0

View File

@ -1,8 +1,12 @@
import { Hocuspocus } from "@hocuspocus/server";
import { Server } from "@hocuspocus/server";
const server = new Hocuspocus({
async onConnect({ connection }) {
connection.requiresAuthentication = false;
const server = Server.configure({
async onAuthenticate(data) {
const { token } = data;
if (token !== "hocuspocus-token") {
throw new Error("Not authorized!");
}
},
port: 4242,
});