I am running tiptap with hocuspocus websocket for updating content to a database. This works fine locally but when I deploy it to my web hosting (where I run a custom next.js server) the web page returns nothing more than just a text “OK”.
This is my hocuspocus server:
import { Hocuspocus } from '@hocuspocus/server'
const onStoreDocument = async incomingData => {
//store to database
}
const onLoadDocument = async incomingData => {
//load from database
return document
}
export const server = new Hocuspocus({
port: 1234,
onStoreDocument,
onLoadDocument,
debounce: 5000
})
}
Which I call from instrumentation.ts like this:
export async function register() {
const hocuspocusServer = await import("@/app/lib/hocuspocusServer")
hocuspocusServer.server.listen()
}
Locally I see my tiptap editor just as expected, but when built and uploaded to my web hosting I get the following result:
What am I doing wrong? I suspect the "OK" comes from the server.listen() but can't understand why it is doing this and especially when it isn't doing it locally / under development.
(Removing the hocuspocus server makes the tiptap editor run normally also on my web-hosting, but obviously without database connection)