getPathId
The getPathId
method is used to get the Id
of the path that is being served.
getPathId(): string
returns | string | The |
---|
This is useful for when you want to know which path the current Durable Object is serving - for the purposes of logging, for example.
Example
This example logs the path being served by the Durable Object every time a synchronization method is handled.
import {WsServerDurableObject} from 'tinybase/synchronizers/synchronizer-ws-server-durable-object';
export class MyDurableObject extends WsServerDurableObject {
onMessage() {
console.info('Message received on path: ', this.getPathId());
}
}
Since
v5.4.0