Thanks to visit codestin.com
Credit goes to github.com

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

21 files changed

+1720
-190
lines changed

coderd/apidoc/docs.go

+97
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

coderd/apidoc/swagger.json

+85
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

coderd/coderd.go

+4-2
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)