mirror of
https://github.com/coder/coder.git
synced 2025-07-03 16:13:58 +00:00
chore: add support for one-way websockets to backend (#16853)
Closes https://github.com/coder/coder/issues/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
This commit is contained in:
97
coderd/apidoc/docs.go
generated
97
coderd/apidoc/docs.go
generated
@ -8618,6 +8618,7 @@ const docTemplate = `{
|
||||
],
|
||||
"summary": "Watch for workspace agent metadata updates",
|
||||
"operationId": "watch-for-workspace-agent-metadata-updates",
|
||||
"deprecated": true,
|
||||
"parameters": [
|
||||
{
|
||||
"type": "string",
|
||||
@ -8638,6 +8639,44 @@ const docTemplate = `{
|
||||
}
|
||||
}
|
||||
},
|
||||
"/workspaceagents/{workspaceagent}/watch-metadata-ws": {
|
||||
"get": {
|
||||
"security": [
|
||||
{
|
||||
"CoderSessionToken": []
|
||||
}
|
||||
],
|
||||
"produces": [
|
||||
"application/json"
|
||||
],
|
||||
"tags": [
|
||||
"Agents"
|
||||
],
|
||||
"summary": "Watch for workspace agent metadata updates via WebSockets",
|
||||
"operationId": "watch-for-workspace-agent-metadata-updates-via-websockets",
|
||||
"parameters": [
|
||||
{
|
||||
"type": "string",
|
||||
"format": "uuid",
|
||||
"description": "Workspace agent ID",
|
||||
"name": "workspaceagent",
|
||||
"in": "path",
|
||||
"required": true
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "OK",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/codersdk.ServerSentEvent"
|
||||
}
|
||||
}
|
||||
},
|
||||
"x-apidocgen": {
|
||||
"skip": true
|
||||
}
|
||||
}
|
||||
},
|
||||
"/workspacebuilds/{workspacebuild}": {
|
||||
"get": {
|
||||
"security": [
|
||||
@ -10049,6 +10088,7 @@ const docTemplate = `{
|
||||
],
|
||||
"summary": "Watch workspace by ID",
|
||||
"operationId": "watch-workspace-by-id",
|
||||
"deprecated": true,
|
||||
"parameters": [
|
||||
{
|
||||
"type": "string",
|
||||
@ -10068,6 +10108,41 @@ const docTemplate = `{
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/workspaces/{workspace}/watch-ws": {
|
||||
"get": {
|
||||
"security": [
|
||||
{
|
||||
"CoderSessionToken": []
|
||||
}
|
||||
],
|
||||
"produces": [
|
||||
"application/json"
|
||||
],
|
||||
"tags": [
|
||||
"Workspaces"
|
||||
],
|
||||
"summary": "Watch workspace by ID via WebSockets",
|
||||
"operationId": "watch-workspace-by-id-via-websockets",
|
||||
"parameters": [
|
||||
{
|
||||
"type": "string",
|
||||
"format": "uuid",
|
||||
"description": "Workspace ID",
|
||||
"name": "workspace",
|
||||
"in": "path",
|
||||
"required": true
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "OK",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/codersdk.ServerSentEvent"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"definitions": {
|
||||
@ -14621,6 +14696,28 @@ const docTemplate = `{
|
||||
}
|
||||
}
|
||||
},
|
||||
"codersdk.ServerSentEvent": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"data": {},
|
||||
"type": {
|
||||
"$ref": "#/definitions/codersdk.ServerSentEventType"
|
||||
}
|
||||
}
|
||||
},
|
||||
"codersdk.ServerSentEventType": {
|
||||
"type": "string",
|
||||
"enum": [
|
||||
"ping",
|
||||
"data",
|
||||
"error"
|
||||
],
|
||||
"x-enum-varnames": [
|
||||
"ServerSentEventTypePing",
|
||||
"ServerSentEventTypeData",
|
||||
"ServerSentEventTypeError"
|
||||
]
|
||||
},
|
||||
"codersdk.SessionCountDeploymentStats": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
|
Reference in New Issue
Block a user