Skip to content
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

Allow channel setup without connecting #313

Open
michihuber opened this issue Nov 19, 2017 · 1 comment
Open

Allow channel setup without connecting #313

michihuber opened this issue Nov 19, 2017 · 1 comment

Comments

@michihuber
Copy link

Hi,

Thank you very much for sente, it really does save a lot of work!

I have two somewhat related issues:

  1. It would be useful if I could set up the channel without connecting immediately.
  2. When reconnecting, it would be useful to be able to pass new params.

The usecase for 1) would be to set up the channel as part of the system (and get hold of :ch-recv and :send-fn) but not connect just yet if the user needs to authenticate first (e.g., fetch an authentication token through ajax). This would avoid errors being logged while authentication fails in the websocket requests.

Then, when reconnecting (or in this case, connecting), it would be great to be able to pass new params (e.g. in this case, the fetched authentication token).

Right now, I work around this by connecting immediately (which logs errors), and when the token was acquired doing:

(sente/chsk-reconnect!
  (-> chsk
      (assoc-in [:ws-chsk-opts :params :auth-token] token)
      (assoc-in [:ajax-chsk-opts :params :auth-token] token)))

Would you accept a patch for this functionality?

@ptaoussanis
Copy link
Member

ptaoussanis commented Dec 10, 2017

Hi Michi,

Would be happy to look at a PR (maybe 2 separate PRs for the 2 items mentioned above?)- thanks! 👍

Edit to add: Otherwise please 👍 if someone else is reading this and interested in the feature.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants