Skip to content

Commit deef566

Browse files
committed
address comments
1 parent 6ca22a0 commit deef566

File tree

1 file changed

+9
-5
lines changed

1 file changed

+9
-5
lines changed

src/content/changelog/durable-objects/2025-08-21-durable-objects-get-by-name.mdx

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,16 +7,20 @@ products:
77
date: 2025-08-21
88
---
99

10-
You can now create a client (a [Durable Object stub](/durable-objects/api/stub/)) to a Durable Object with a single line of code.
10+
You can now create a client (a [Durable Object stub](/durable-objects/api/stub/)) to a Durable Object with the new `getByName` method, removing the need to convert Durable Object names to IDs and then create a stub.
1111

1212
```js
13+
// Before: (1) translate name to ID then (2) get a client
14+
const objectId = env.MY_DURABLE_OBJECT.idFromName("foo"); // or .newUniqueId()
15+
const stub = env.MY_DURABLE_OBJECT.get(objectId);
16+
17+
// Now: retrieve client to Durable Object directly via its name
1318
const stub = env.MY_DURABLE_OBJECT.getByName("foo");
14-
// Now the request is sent to the remote Durable Object.
19+
20+
// Use client to send request to the remote Durable Object
1521
const rpcResponse = await stub.sayHello();
1622
```
1723

1824
Each Durable Object has a globally-unique name, which allows you to send requests to a specific object from anywhere in the world. Thus, a Durable Object can be used to coordinate between multiple clients who need to work together. You can have billions of Durable Objects, providing isolation between application tenants.
1925

20-
For more information, check out:
21-
22-
- [API Documentation](/durable-objects/api/namespace/#getbyname)
26+
To learn more, visit the Durable Objects [API Documentation](/durable-objects/api/namespace/#getbyname) or the [getting started guide](/durable-objects/get-started/).

0 commit comments

Comments
 (0)