mirror of
https://github.com/coder/coder.git
synced 2026-09-24 15:04:27 +08:00
feat: add support for WorkspaceUpdates to WebsocketDialer (#15534)
closes #14730 Adds support for WorkspaceUpdates to the WebsocketDialer. This allows us to dial the new endpoint added in #14847 and connect it up to a `tailnet.Controllers` to connect to all agents over the tailnet. I refactored the fakeWorkspaceUpdatesProvider to a mock and moved it to `tailnettest` so it could be more easily reused. The Mock is a little more full-featured.
This commit is contained in:
@@ -216,17 +216,6 @@ func (c *Client) DialAgent(dialCtx context.Context, agentID uuid.UUID, options *
|
||||
if err != nil {
|
||||
return nil, xerrors.Errorf("parse url: %w", err)
|
||||
}
|
||||
q := coordinateURL.Query()
|
||||
// The current version includes additions
|
||||
//
|
||||
// 2.1 GetAnnouncementBanners on the Agent API (version locked to Tailnet API)
|
||||
// 2.2 PostTelemetry on the Tailnet API
|
||||
// 2.3 RefreshResumeToken, WorkspaceUpdates
|
||||
//
|
||||
// Since resume tokens and telemetry are optional, and fail gracefully, and we don't use
|
||||
// WorkspaceUpdates to talk to a single agent, we ask for version 2.0 for maximum compatibility
|
||||
q.Add("version", "2.0")
|
||||
coordinateURL.RawQuery = q.Encode()
|
||||
|
||||
dialer := NewWebsocketDialer(options.Logger, coordinateURL, &websocket.DialOptions{
|
||||
HTTPClient: c.client.HTTPClient,
|
||||
|
||||
Reference in New Issue
Block a user