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

Create WebsocketTransport without connecting automatically #1457

Closed
winstondu opened this issue Oct 18, 2020 · 1 comment · Fixed by #1458
Closed

Create WebsocketTransport without connecting automatically #1457

winstondu opened this issue Oct 18, 2020 · 1 comment · Fixed by #1458
Milestone

Comments

@winstondu
Copy link
Contributor

winstondu commented Oct 18, 2020

Feature request

Currently, the designated initializer for the WebSocketTransport immediately connects the websocket.

We wish to manually control when it does its first connection.

Motivation

We want to our app's webservers to able to handle load, and at high traffic times we actually want the ability to disable automatic websocket connections to our server at app startup.

Proposed solution

Add a parameter to the designated initializer on whether the websocket should connect immediately on initialization. In otherwords, wrap the websocket.connect() call in an if statement.

Additional notes:
Because the mutex-locked reconnect parameter only comes into play after the the first disconnection (which can only happen after the first connection), that parameter does not affect things.

Outstanding Questions

  • It is up to the implementor to decide whether there should be a separate api for the first websocket connection, or if the developer can just call reconnectWebSocket()
@designatednerd
Copy link
Contributor

Seems like a reasonable request, and thank you for adding a PR! I'll keep feedback over on the PR just for the sake of clarity.

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

Successfully merging a pull request may close this issue.

2 participants