mirror of
https://github.com/coder/coder.git
synced 2026-09-24 15:04:27 +08:00
feat(site): use websocket connection for devcontainer updates (#18808)
Instead of polling every 10 seconds, we instead use a WebSocket connection for more timely updates.
This commit is contained in:
Generated
+105
@@ -899,6 +899,111 @@ curl -X POST http://coder-server:8080/api/v2/workspaceagents/{workspaceagent}/co
|
||||
|
||||
To perform this operation, you must be authenticated. [Learn more](authentication.md).
|
||||
|
||||
## Watch workspace agent for container updates
|
||||
|
||||
### Code samples
|
||||
|
||||
```shell
|
||||
# Example request using curl
|
||||
curl -X GET http://coder-server:8080/api/v2/workspaceagents/{workspaceagent}/containers/watch \
|
||||
-H 'Accept: application/json' \
|
||||
-H 'Coder-Session-Token: API_KEY'
|
||||
```
|
||||
|
||||
`GET /workspaceagents/{workspaceagent}/containers/watch`
|
||||
|
||||
### Parameters
|
||||
|
||||
| Name | In | Type | Required | Description |
|
||||
|------------------|------|--------------|----------|--------------------|
|
||||
| `workspaceagent` | path | string(uuid) | true | Workspace agent ID |
|
||||
|
||||
### Example responses
|
||||
|
||||
> 200 Response
|
||||
|
||||
```json
|
||||
{
|
||||
"containers": [
|
||||
{
|
||||
"created_at": "2019-08-24T14:15:22Z",
|
||||
"id": "string",
|
||||
"image": "string",
|
||||
"labels": {
|
||||
"property1": "string",
|
||||
"property2": "string"
|
||||
},
|
||||
"name": "string",
|
||||
"ports": [
|
||||
{
|
||||
"host_ip": "string",
|
||||
"host_port": 0,
|
||||
"network": "string",
|
||||
"port": 0
|
||||
}
|
||||
],
|
||||
"running": true,
|
||||
"status": "string",
|
||||
"volumes": {
|
||||
"property1": "string",
|
||||
"property2": "string"
|
||||
}
|
||||
}
|
||||
],
|
||||
"devcontainers": [
|
||||
{
|
||||
"agent": {
|
||||
"directory": "string",
|
||||
"id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
|
||||
"name": "string"
|
||||
},
|
||||
"config_path": "string",
|
||||
"container": {
|
||||
"created_at": "2019-08-24T14:15:22Z",
|
||||
"id": "string",
|
||||
"image": "string",
|
||||
"labels": {
|
||||
"property1": "string",
|
||||
"property2": "string"
|
||||
},
|
||||
"name": "string",
|
||||
"ports": [
|
||||
{
|
||||
"host_ip": "string",
|
||||
"host_port": 0,
|
||||
"network": "string",
|
||||
"port": 0
|
||||
}
|
||||
],
|
||||
"running": true,
|
||||
"status": "string",
|
||||
"volumes": {
|
||||
"property1": "string",
|
||||
"property2": "string"
|
||||
}
|
||||
},
|
||||
"dirty": true,
|
||||
"error": "string",
|
||||
"id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
|
||||
"name": "string",
|
||||
"status": "running",
|
||||
"workspace_folder": "string"
|
||||
}
|
||||
],
|
||||
"warnings": [
|
||||
"string"
|
||||
]
|
||||
}
|
||||
```
|
||||
|
||||
### Responses
|
||||
|
||||
| Status | Meaning | Description | Schema |
|
||||
|--------|---------------------------------------------------------|-------------|----------------------------------------------------------------------------------------------------------|
|
||||
| 200 | [OK](https://tools.ietf.org/html/rfc7231#section-6.3.1) | OK | [codersdk.WorkspaceAgentListContainersResponse](schemas.md#codersdkworkspaceagentlistcontainersresponse) |
|
||||
|
||||
To perform this operation, you must be authenticated. [Learn more](authentication.md).
|
||||
|
||||
## Coordinate workspace agent
|
||||
|
||||
### Code samples
|
||||
|
||||
Reference in New Issue
Block a user