-
Notifications
You must be signed in to change notification settings - Fork 107
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
How to pass recover option when subscribe to a channel #115
Comments
@lsc20051426 hi, description in docs is about internal protocol which is only used for automatic recovery in case of network disconnects at moment. But I understand what you mean – actually there is rather old open pull request #44 that allows to do what you are describing. But that pr was made for version 1 of centrifuge-js, so not actual at moment. I did not merge it because I have not found enough motivation and live use case to extend API. Could you describe how you are planning to use this? Are you planning to save offset in localStorage? Why do you want this instead of asking database about actual state? |
you are right. we save offset in localStorage.
Here are some hacks for js code(just example):
|
Can you give a bit more use case description? Why do you need this instead of asking initial state from main application database? |
I think it's now available with https://github.com/centrifugal/centrifuge-js#subscribe-since-known-position |
https://centrifugal.github.io/centrifugo/transports/recovery/
Is there a way to pass the recover from client(as mention in above link) to fetching some history messages?
When server receives subscribe command with boolean flag recover set to true and offset, epoch set to values last seen by a client (see SubscribeRequest type in protocol definitions) it can try to find all missed publications from history cache. Recovered publications will be passed to client in subscribe Reply in correct order, and your publication handler will be automatically called to process each missed message.
in Centrifuge-JS:
probably?
or is there are some other ways to do it?
The text was updated successfully, but these errors were encountered: