Skip to content

Commit 327660b

Browse files
Oxyjunhyperlint-ai[bot]lambrospetrou
authored
Apply suggestions from code review
Co-authored-by: hyperlint-ai[bot] <154288675+hyperlint-ai[bot]@users.noreply.github.com> Co-authored-by: Lambros Petrou <[email protected]>
1 parent cfaa746 commit 327660b

File tree

1 file changed

+4
-4
lines changed
  • src/content/docs/durable-objects/api

1 file changed

+4
-4
lines changed

src/content/docs/durable-objects/api/state.mdx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import { Tabs, TabItem } from "~/components";
1111

1212
The `DurableObjectState` interface is accessible as an instance property on the Durable Objects class. This interface encapsulates methods that modify the state of a Durable Object, for example which WebSockets are attached to a Durable Object instance or how the runtime should handle concurrent Durable Object requests.
1313

14-
The `DurableObjectState` interface is different that the [Storage API](/durable-objects/api/storage-api) in that it does not have top level methods which manipulate persistant application data. These methods are instead encapsulated in the [`DurableObjectStorage`](/durable-objects/api/storage-api) interface and accessed by [`DurableObjectState::storage`](/durable-objects/api/state/#storage).
14+
The `DurableObjectState` interface is different from the [Storage API](/durable-objects/api/storage-api) in that it does not have top-level methods which manipulate persistent application data. These methods are instead encapsulated in the [`DurableObjectStorage`](/durable-objects/api/storage-api) interface and accessed by [`DurableObjectState::storage`](/durable-objects/api/state/#storage).
1515

1616
<Tabs> <TabItem label="JavaScript" icon="seti:javascript">
1717

@@ -108,7 +108,7 @@ export class MyDurableObject extends DurableObject {
108108

109109
`acceptWebSocket` is part of the [WebSocket Hibernation API](durable-objects/reference/websockets/#websocket-hibernation), which allows a Durable Object instance to be removed from memory to save costs while keeping its WebSockets connected.
110110

111-
`acceptWebSocket` adds a WebSocket to the set of WebSockets attached to the Durable Object instance. Once called, any incoming messages will be delivered by calling the Durable Objects `webSocketMessage` handler, and `webSocketClose` will be invoked upon disconnect. After calling `acceptWebSocket`, the WebSocket is accepted and its `send` and `close` methods can be used.
111+
`acceptWebSocket` adds a WebSocket to the set of WebSockets attached to the Durable Object instance. Once called, any incoming messages will be delivered by calling the Durable Object's `webSocketMessage` handler, and `webSocketClose` will be invoked upon disconnect. After calling `acceptWebSocket`, the WebSocket is accepted and its `send` and `close` methods can be used.
112112

113113
The [WebSocket Hibernation API](durable-objects/reference/websockets/#websocket-hibernation) takes the place of the standard [WebSockets API](/workers/runtime-apis/websockets/). Therefore, `ws.accept` must not have been called separately and `ws.addEventListener` method will not receive events as they will instead be delivered to the Durable Object.
114114

@@ -131,7 +131,7 @@ The WebSocket Hibernation API permits a maximum of 32,768 WebSocket connections
131131

132132
:::note[`waitUntil` is not necessary]
133133

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.
135135

136136
:::
137137

@@ -237,7 +237,7 @@ If no parameter or a parameter of `0` is provided and a timeout has been previou
237237

238238
### `abort`
239239

240-
`abort` is used to forcibly reset a Durable Object instance. A JavaScript Error with the message passed as a parameter will be logged. This error is not able to be caught within the applciation code.
240+
`abort` is used to forcibly reset a Durable Object instance. A JavaScript `Error` with the message passed as a parameter will be logged. This error is not able to be caught within the application code.
241241

242242
```js
243243
// Durable Object

0 commit comments

Comments
 (0)