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

Improve initial websocket connection time #574

Open
feross opened this issue Jan 15, 2016 · 2 comments
Open

Improve initial websocket connection time #574

feross opened this issue Jan 15, 2016 · 2 comments

Comments

@feross
Copy link
Member

@feross feross commented Jan 15, 2016

For use cases like https://instant.io, it would be nice if there was some way to pre-connect to the tracker servers that we know we're going to need once the user adds a torrent to the client.

I'd like to try to do this without adding new APIs to webtorrent that are specific to this use case. There might need to be internal changes to make this easier to do.

This would really help with the perceived performance when someone clicks a link to https://instant.io since websocket connect time is non-trivial and in the range of 1-2s.

@DiegoRBaquero

This comment has been minimized.

Copy link
Member

@DiegoRBaquero DiegoRBaquero commented Mar 12, 2016

I was investigating... we would need to make the WebSocketTracker available to the WebTorrent client and just starting a websocket tracker with the client parameter in null. Will test my ideas soon.

@guanzo

This comment has been minimized.

Copy link
Contributor

@guanzo guanzo commented Aug 13, 2019

The websocket tracker could fall back to HTTP and seamlessly switch to the websocket once connected. This would require an http endpoint that handles webrtc signaling.

My users take on average 800ms to connect to the tracker with a websocket. That's 800ms worth of time that could be spent signaling over http! I'm experimenting with it now, it's a bit tricky to implement for me since i'm trickling candidates.

EDIT:

You can emulate a websocket connection with:

  • fetch API - client sends offers + candidates to tracker
  • EventSource API - tracker pushes answers + candidates to client.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
3 participants
You can’t perform that action at this time.