hocuspocus icon indicating copy to clipboard operation
hocuspocus copied to clipboard

Connection check in multiplexing

Open ilya2204 opened this issue 2 years ago • 7 comments

The problem I am facing When using multiplexing for connecting to a large number of documents via one socket the socket constantly spams with connection check messages (as I understand it is pingInterval) and this happens for each document separately.

The solution I would like Perhaps it can be done so that the connection is checked only for the main socket, and not for each document separately?

ilya2204 avatar Oct 05 '23 10:10 ilya2204

hi @ilya2204, this shouldnt happen. I think you are seeing awareness updates, which are updated every 30 seconds per document. If you don't need awareness, you can disable it by passing awareness: null to the provider, but make sure that you have at least one provider that uses it (or otherwise receives messages before HocuspocusProviderWebsocket.messageReconnectTimeout

janthurau avatar Oct 09 '23 18:10 janthurau

Hello @janthurau, if this is awareness, it still doesn’t seem to make sense that when using multiplexing, each document sends its awareness once every 30 seconds? Is there a way to raise this timeout? With a large number of documents (several hundred), the socket sends messages continuously

ilya2204 avatar Oct 09 '23 19:10 ilya2204

I dont think you can raise that as this is yjs internals (see https://docs.yjs.dev/api/about-awareness), but you can just disable it if you don't need it for some (or all) documents.

janthurau avatar Oct 09 '23 19:10 janthurau

Understood thanks. It's just that there are actually different parameters messageReconnectTimeout, forceSyncInterval, pingInterval, outdatedTimeout quite confusing.

ilya2204 avatar Oct 09 '23 19:10 ilya2204

I could be wrong, but at first glance, if you copy Awareness class and replace the timeout with the desired one, then everything should work.

ilya2204 avatar Oct 09 '23 19:10 ilya2204

@janthurau but it seems that doing ping/pong for each document on the socket, and not for the entire socket as a whole, is an overhead

ilya2204 avatar Oct 10 '23 08:10 ilya2204

@ilya2204 were you able to figure out a solution for this?

ArihantBapna avatar Dec 18 '23 20:12 ArihantBapna