Skip to content

Add back connection type query param - #14

Merged
code-asher merged 1 commit into
coder:code-server-v2from
code-asher:connection-type
Nov 10, 2021
Merged

code-asher merged 1 commit into
coder:code-server-v2from
code-asher:connection-type

Conversation

@code-asher

Copy link
Copy Markdown
Member

@code-asher
code-asher requested a review from jsjoeio November 10, 2021 22:18

@jsjoeio jsjoeio left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You're unstoppable!

socket = await createSocket(options.logService, options.socketFactory, options.host, options.port, `reconnectionToken=${options.reconnectionToken}&reconnection=${options.reconnectionProtocol ? 'true' : 'false'}`, timeoutCancellationToken);
// NOTE@coder: Add connection type to the socket. This is so they can be
// distinguished by the backend.
socket = await createSocket(options.logService, options.socketFactory, options.host, options.port, `type=${connectionTypeToString(connectionType)}&reconnectionToken=${options.reconnectionToken}&reconnection=${options.reconnectionProtocol ? 'true' : 'false'}`, timeoutCancellationToken);

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

❓ Why does the backend need to know the type connection? And what's an example connection type? ws, http, https?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Type is either ExtensionHost or Management. The product uses websocket connections to determine if an editor is open. However since VS Code has two websockets it always counts as two opens.

Labeling the websockets with type lets the backend distinguish between the two sockets so it can count just one open.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh got it. That makes sense. Thanks for the explainer!

@code-asher
code-asher merged commit a253181 into coder:code-server-v2 Nov 10, 2021
@code-asher
code-asher deleted the connection-type branch November 10, 2021 22:36
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 this pull request may close these issues.

2 participants