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

Add fallback long-polling mode #42

Open
tailhook opened this issue Jul 21, 2017 · 0 comments
Open

Add fallback long-polling mode #42

tailhook opened this issue Jul 21, 2017 · 0 comments
Milestone

Comments

@tailhook
Copy link
Collaborator

tailhook commented Jul 21, 2017

As requested in swindon-rs/swindon-js#6.

Basics

  1. We support this only for swindon-lattice protocol, not for generic websockets
  2. We process same url as websocket with POST /path?swindon_action=xxx&swindon_token=yyy

Mapping

  1. Connect with POST /path?swindon_action=connect, it returns hello message and token you pass to swindon_token in subsequent connections. Http errors from backend are passed as is.
  2. Method calls are executed in one method per request fasion POST /path?swindon_action=call&swindon_token=yyy. The actual method name and parameters are in the same format as usually sent to backend. Surely, swindon.* methods are disallowed (return 401). Return value is sent in HTTP response.
  3. Input messages (pub-sub, lattices), can be fetched with POST /path?swindon_action=read&swindon_token=yyy&last_received=0&timeout=10&delay=100. With client-defined timeout in seconds. And client-defined buffering delay in milliseconds to give swindon chance to buffer more than one message. Messages are gathered in list of jsons.
  4. If session (token) is expired we return 401

Pros:

  1. Simple easy to understand mapping

Cons:

  1. Needs at least two HTTP connections (which are scarce in browsers)
  2. call requests can occupy connections, leaving read in queue (which might be good too)

/cc @popravich, @rrader?

@tailhook tailhook added this to the v0.6.2 milestone Jul 21, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant