admin管理员组文章数量:1355564
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)
本文标签: Hocuspocus server websocket returns quotOKquot on nextjs custom serverStack Overflow
版权声明:本文标题:Hocuspocus server websocket returns "OK" on next.js custom server - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1743937010a2564866.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论