@cloudflare/containers 0.0.20 → 0.0.21
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +5 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -60,7 +60,7 @@ The main class that extends a container-enbled Durable Object to provide additio
|
|
|
60
60
|
|
|
61
61
|
#### Properties
|
|
62
62
|
|
|
63
|
-
- `defaultPort?`: Optional default port to use when communicating with the container. If not set, you must specify port in containerFetch calls
|
|
63
|
+
- `defaultPort?`: Optional default port to use when communicating with the container. If not set, you must specify port in `containerFetch` calls, or use `switchPort`.
|
|
64
64
|
- `requiredPorts?`: Array of ports that should be checked for availability during container startup. Used by startAndWaitForPorts when no specific ports are provided.
|
|
65
65
|
- `sleepAfter`: How long to keep the container alive without activity (format: number for seconds, or string like "5m", "30s", "1h")
|
|
66
66
|
- `env`: Environment variables to pass to the container (Record<string, string>)
|
|
@@ -101,6 +101,10 @@ If you don't stop the container here, the activity tracker will be renewed, and
|
|
|
101
101
|
- `containerFetch(url, init?, port?)`: Standard fetch-like signature with URL string/object and RequestInit options
|
|
102
102
|
Either port parameter or defaultPort must be specified.
|
|
103
103
|
When you call any of the fetch functions, the activity will be automatically renewed, and if the container will be started if not already running.
|
|
104
|
+
**Do not use 'containerFetch' when trying to send a Request object with a websocket, until [this issue is addressed](https://github.com/cloudflare/workerd/issues/2319).
|
|
105
|
+
You can overcome this limitation by doing:
|
|
106
|
+
`container.fetch(switchPort(request, port))`
|
|
107
|
+
|
|
104
108
|
- `start()`: Starts the container if it's not running and sets up monitoring, without waiting for any ports to be ready.
|
|
105
109
|
- `startAndWaitForPorts(ports?, maxTries?)`: Starts the container using `start()` and then waits for specified ports to be ready. If no ports are specified, uses `requiredPorts` or `defaultPort`. If no ports can be determined, just starts the container without port checks.
|
|
106
110
|
- `stop(signal = SIGTERM)`: Sends the specified signal to the container.
|