Skip to content

Commit 589bb11

Browse files
committed
allow shard config in the providerWebsocket
1 parent 7b42fa2 commit 589bb11

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

packages/provider/src/TiptapCollabProviderWebsocket.ts

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,22 @@ export interface AdditionalTiptapCollabProviderWebsocketConfiguration {
1717
* If you are using the on-premise version of TiptapCollab, put your baseUrl here (e.g. https://collab.yourdomain.com)
1818
*/
1919
baseUrl?: string
20+
21+
/**
22+
* Only fill this if you are using Tiptap Collab HA.
23+
*/
24+
shardKey?: string
2025
}
2126

2227
export class TiptapCollabProviderWebsocket extends HocuspocusProviderWebsocket {
2328
constructor(configuration: TiptapCollabProviderWebsocketConfiguration) {
24-
super({ ...configuration as HocuspocusProviderWebsocketConfiguration, url: configuration.baseUrl ?? `wss://${configuration.appId}.collab.tiptap.cloud` })
29+
let url = configuration.baseUrl ?? `wss://${configuration.appId}.collab.tiptap.cloud`
30+
31+
if (configuration.shardKey) {
32+
url += url.includes('?') ? '&' : '?'
33+
url += `shard=${configuration.shardKey}`
34+
}
35+
36+
super({ ...configuration as HocuspocusProviderWebsocketConfiguration, url })
2537
}
2638
}

0 commit comments

Comments
 (0)