Skip to content

Commit 9bc727e

Browse files
authored
chore: add support for one-way websockets to backend (#16853)
Closes #16775 ## Changes made - Added `OneWayWebSocket` function that establishes WebSocket connections that don't allow client-to-server communication - Added tests for the new function - Updated API endpoints to make new WS-based endpoints, and mark previous SSE-based endpoints as deprecated - Updated existing SSE handlers to use the same core logic as the new WS handlers ## Notes - Frontend changes handled via #16855
1 parent d3050a7 commit 9bc727e

File tree

21 files changed

+1720
-190
lines changed

21 files changed

+1720
-190
lines changed

coderd/apidoc/docs.go

Lines changed: 97 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

coderd/apidoc/swagger.json

Lines changed: 85 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

coderd/coderd.go

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1248,7 +1248,8 @@ func New(options *Options) *API {
12481248
httpmw.ExtractWorkspaceParam(options.Database),
12491249
)
12501250
r.Get("/", api.workspaceAgent)
1251-
r.Get("/watch-metadata", api.watchWorkspaceAgentMetadata)
1251+
r.Get("/watch-metadata", api.watchWorkspaceAgentMetadataSSE)
1252+
r.Get("/watch-metadata-ws", api.watchWorkspaceAgentMetadataWS)
12521253
r.Get("/startup-logs", api.workspaceAgentLogsDeprecated)
12531254
r.Get("/logs", api.workspaceAgentLogs)
12541255
r.Get("/listening-ports", api.workspaceAgentListeningPorts)
@@ -1280,7 +1281,8 @@ func New(options *Options) *API {
12801281
r.Route("/ttl", func(r chi.Router) {
12811282
r.Put("/", api.putWorkspaceTTL)
12821283
})
1283-
r.Get("/watch", api.watchWorkspace)
1284+
r.Get("/watch", api.watchWorkspaceSSE)
1285+
r.Get("/watch-ws", api.watchWorkspaceWS)
12841286
r.Put("/extend", api.putExtendWorkspace)
12851287
r.Post("/usage", api.postWorkspaceUsage)
12861288
r.Put("/dormant", api.putWorkspaceDormant)

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy