You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@@ -53,7 +53,7 @@ export class MyDurableObject extends DurableObject {
53
53
54
54
### `waitUntil`
55
55
56
-
`waitUntil` waits until the promise which is passed as a parameter resolves and can extends an event context up to 30 seconds after the last client disconnects.
56
+
`waitUntil` waits until the promise which is passed as a parameter resolves and can extends an <GlossaryTooltipterm="event context">event context</GlossaryTooltip> up to 30 seconds after the last client disconnects.
57
57
58
58
:::note[`waitUntil` is not necessary]
59
59
@@ -71,13 +71,13 @@ The event context for a Durable Objects extends at least 60 seconds after the la
71
71
72
72
### `blockConcurrencyWhile`
73
73
74
-
`blockConcurrencyWhile` executes an async callback while blocking any other events from being delivered to the Durable Object instance until the callback completes. This method guarantees ordering and prevents concurrent requests. All events that were not explicitly initiated as part of the callback itself will be blocked. Once the callback completes, All other events will be delivered.
74
+
`blockConcurrencyWhile` executes an async callback while blocking any other events from being delivered to the Durable Object instance until the callback completes. This method guarantees ordering and prevents concurrent requests. All events that were not explicitly initiated as part of the callback itself will be blocked. Once the callback completes, all other events will be delivered.
75
75
76
-
`blockConcurrencyWhile` is commonly used within the constructor of the Durable Object class to enforce that initialization must occur before any requests are delivered. Another use case is executing `async` operations based on the current state of the Durable Object instance and using `blockConcurrencyWhile` to prevent that state from changing while yeilding the event loop.
76
+
`blockConcurrencyWhile` is commonly used within the constructor of the Durable Object class to enforce initialization to occur before any requests are delivered. Another use case is executing `async` operations based on the current state of the Durable Object instance and using `blockConcurrencyWhile` to prevent that state from changing while yielding the event loop.
77
77
78
78
If the callback throws an exception, the object will be terminated and reset. This ensures that the object cannot be left stuck in an uninitialized state if something fails unexpectedly. To avoid this behavior, enclose the body of your callback in a `try...catch` block to ensure it cannot throw an exception.
79
79
80
-
To help mitigate deadlocks there is a 30s timeout applied when executing the callback. If this timeout is exceeded the Durable Object instance will be reset. It is best practice to have the callback do as little work as possible to improve overall request throughput to the Durable Object instance.
80
+
To help mitigate deadlocks there is a 30 second timeout applied when executing the callback. If this timeout is exceeded, the Durable Object instance will be reset. It is best practice to have the callback do as little work as possible to improve overall request throughput to the Durable Object instance.
81
81
82
82
```js
83
83
// Durable Object
@@ -131,7 +131,7 @@ The WebSocket Hibernation API permits a maximum of 32,768 WebSocket connections
131
131
132
132
:::note[`waitUntil` is not necessary]
133
133
134
-
Disconnected WebSockets are not returned by this method, but `getWebSockets` may still return websockets even after `ws.close` has been called. For example, if the server-side WebSocket sends a close, but does not receive one back (and has not detected a disconnect from the client), then the connection is in the CLOSING 'readyState'. The client might send more messages, so the WebSocket is technically not disconnected.
134
+
Disconnected WebSockets are not returned by this method, but `getWebSockets` may still return WebSockets even after `ws.close` has been called. For example, if the server-side WebSocket sends a close, but does not receive one back (and has not detected a disconnect from the client), then the connection is in the CLOSING 'readyState'. The client might send more messages, so the WebSocket is technically not disconnected.
135
135
136
136
:::
137
137
@@ -141,7 +141,7 @@ Disconnected WebSockets are not returned by this method, but `getWebSockets` may
141
141
142
142
#### Return values
143
143
144
-
- An `Array<WebSocket>`
144
+
- An `Array<WebSocket>`.
145
145
146
146
### `setWebSocketAutoResponse`
147
147
@@ -153,7 +153,7 @@ Disconnected WebSockets are not returned by this method, but `getWebSockets` may
153
153
154
154
#### Parameters
155
155
156
-
- An optional `WebSocketRequestResponsePair(request string, response string)` enabling any WebSocket accepted via [`DurableObjectState::acceptWebSocket`](/durable-objects/api/state/#acceptwebsocket) to automatically reply to the provided response when it receives the provided request. Both request and response are limited to 2,048 characters each. If the parameter is omitted any previously set auto-response configuration will be removed. [`DurableObjectState::getWebSocketAutoResponseTimestamp`](/durable-objects/api/state/#getwebsocketautoresponsetimestamp) will still reflect the last timestamp that an auto-response was sent.
156
+
- An optional `WebSocketRequestResponsePair(request string, response string)` enabling any WebSocket accepted via [`DurableObjectState::acceptWebSocket`](/durable-objects/api/state/#acceptwebsocket) to automatically reply to the provided response when it receives the provided request. Both request and response are limited to 2,048 characters each. If the parameter is omitted, any previously set auto-response configuration will be removed. [`DurableObjectState::getWebSocketAutoResponseTimestamp`](/durable-objects/api/state/#getwebsocketautoresponsetimestamp) will still reflect the last timestamp that an auto-response was sent.
157
157
158
158
#### Return values
159
159
@@ -175,7 +175,7 @@ Disconnected WebSockets are not returned by this method, but `getWebSockets` may
175
175
176
176
#### Return values
177
177
178
-
- A `WebSocketRequestResponsePair` or null
178
+
- A `WebSocketRequestResponsePair` or null.
179
179
180
180
### `getWebSocketAutoResponseTimestamp`
181
181
@@ -219,7 +219,7 @@ If no parameter or a parameter of `0` is provided and a timeout has been previou
219
219
220
220
#### Return values
221
221
222
-
- A number or null if the timeout has not been set.
222
+
- A number, or null if the timeout has not been set.
Copy file name to clipboardExpand all lines: src/content/glossary/durable-objects.yaml
+14-10Lines changed: 14 additions & 10 deletions
Original file line number
Diff line number
Diff line change
@@ -5,29 +5,29 @@ entries:
5
5
general_definition: |-
6
6
The product name, or the collective noun referring to more than one Durable Object instance.
7
7
8
-
- term: "Namespace"
8
+
- term: "namespace"
9
9
general_definition: |-
10
-
A container for a collection of Durable Objects that all share the same Durable Object (class) definition. A single Namespace can have (tens of) millions of Durable Objects. Metrics are scoped per Namespace.
10
+
A container for a collection of Durable Objects that all share the same Durable Object (class) definition. A single namespace can have (tens of) millions of Durable Objects. Metrics are scoped per namespace.
11
11
12
12
- term: "Durable Object"
13
13
general_definition: |-
14
-
An individual Durable Object. A Durable Object is globally unique (referenced by ID), provides a global point of coordination for all methods/requests sent to it, and has private, persistent storage that is not shared with other Durable Objects within a Namespace.
14
+
An individual instance of a Durable Object class. A Durable Object is globally unique (referenced by ID), provides a global point of coordination for all methods/requests sent to it, and has private, persistent storage that is not shared with other Durable Objects within a namespace.
15
15
16
-
- term: "Stub"
16
+
- term: "stub"
17
17
general_definition: |-
18
-
An object that refers to a unique Durable Object within a Namespace and allows you to call into that Durable Object via RPC methods or the `fetch` API. For example, `let stub = env.MY_DURABLE_OBJECT.get(id)`
18
+
An object that refers to a unique Durable Object within a namespace and allows you to call into that Durable Object via RPC methods or the `fetch` API. For example, `let stub = env.MY_DURABLE_OBJECT.get(id)`
19
19
20
20
- term: "actor"
21
21
general_definition: |-
22
-
A term referring to a unique Durable Object.
22
+
A term referring to a unique Durable Object. See "Durable Object".
23
23
24
24
- term: "instance"
25
25
general_definition: |-
26
-
See 'actor'.
26
+
See "actor".
27
27
28
28
- term: "Durable Object class"
29
29
general_definition: |-
30
-
The JavaScript class that defines the methods (RPC) and handlers (`fetch`, `alarm`) as part of your Durable Object, and/or an optional `constructor`. All Durable Objects within a single Namespace share the same class definition.
30
+
The JavaScript class that defines the methods (RPC) and handlers (`fetch`, `alarm`) as part of your Durable Object, and/or an optional `constructor`. All Durable Objects within a single namespace share the same class definition.
31
31
32
32
- term: "Storage Backend"
33
33
general_definition: |-
@@ -50,7 +50,7 @@ entries:
50
50
general_definition: |-
51
51
API methods part of Storage API that support SQL querying.
52
52
53
-
- term: Migration
53
+
- term: "migration"
54
54
general_definition: |-
55
55
A Durable Object migration is a mapping process from a class name to a runtime state.
56
56
Initiate a Durable Object migration when you need to:
@@ -60,6 +60,10 @@ entries:
60
60
- Delete a Durable Object class.
61
61
- Transfer an existing Durable Objects class.
62
62
63
-
- term: Alarm
63
+
- term: "alarm"
64
64
general_definition: |-
65
65
A Durable Object alarm is a mechanism that allows you to schedule the Durable Object to be woken up at a time in the future.
66
+
67
+
- term: "event context"
68
+
general_definition: |-
69
+
The duration for which a Durable Object is kept in memory.
0 commit comments