Skip to content

Data duplication on server restart #318

Answered by BitPhinix
karthikcodes6 asked this question in Q&A
Discussion options

You must be logged in to vote

I'm guessing from your previous issue/question you are only persisting the serialized version of the yjs document. You'll have to store the actual yjs document state inside some sort of DB. Hocuspocus offers multiple extensions to do it for you, like @hocuspocus/extension-redis:

import { Server } from '@hocuspocus/server'
import { Redis } from '@hocuspocus/extension-redis'

const server = Server.configure({
  extensions: [
    new Redis({
      // [required] Hostname of your Redis instance
      host: '127.0.0.1',

      // [required] Port of your Redis instance
      port: 6379,
    })
  ],
})

server.listen()

Replies: 4 comments 3 replies

Comment options

You must be logged in to vote
0 replies
Answer selected by BitPhinix
Comment options

You must be logged in to vote
1 reply
@karthikcodes6
Comment options

Comment options

You must be logged in to vote
1 reply
@Czechh
Comment options

Comment options

You must be logged in to vote
1 reply
@LT1211
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
5 participants
Converted from issue

This discussion was converted from issue #317 on February 03, 2022 14:30.