API reference / @evolu/nodejs / index / NodeJsRelayConfig
Interface: NodeJsRelayConfig
Defined in: nodejs/src/local-first/Relay.ts:35
Extends
Properties
| Property | Modifier | Type | Description | Inherited from | Defined in |
|---|---|---|---|---|---|
enableLogging? | readonly | boolean | Enable or disable console logging (default: false). When true, logs are output to the Console; when false, logging is disabled for all methods except error, which always outputs to ensure critical issues are not missed. | RelayConfig.enableLogging | common/dist/src/Console.d.ts:80 |
isOwnerAllowed? | readonly | (ownerId) => MaybeAsync<boolean> | Optional callback to check if an OwnerId is allowed to access the relay. If this callback is not provided, all owners are allowed. The callback receives the OwnerId and returns a MaybeAsync boolean: true to allow access, or false to deny. The callback can be synchronous (for SQLite or in-memory checks) or asynchronous (for calling remote APIs). The callback returns a boolean rather than an error type because error handling and logging are the responsibility of the callback implementation. OwnerId is used rather than short-lived tokens because this only controls relay access, not write permissions. Since all data is encrypted on the relay, OwnerId exposure is safe. Owners specify which relays to connect to via OwnerTransport. In WebSocket-based implementations, this check occurs before accepting the connection, with the OwnerId typically extracted from the URL Path (e.g., ws://localhost:4000/<ownerId>). The relay requires the URL to be in the correct format for OwnerId extraction. ### Example // Client const transport = createOwnerWebSocketTransport({ url: "wss://relay.evolu.dev", ownerId: owner.id, }); const evolu = createEvolu(deps)(Schema, { transports: [transport], }); // Relay isOwnerAllowed: (ownerId) => Promise.resolve(ownerId === "6jy_2F4RT5qqeLgJ14_dnQ"), | RelayConfig.isOwnerAllowed | common/dist/src/local-first/Relay.d.ts:62 |
isOwnerWithinQuota | readonly | (ownerId, requiredBytes) => MaybeAsync<boolean> | Callback called before an attempt to write, to check if an OwnerId has sufficient quota for the write. The callback receives the OwnerId and the total bytes that would be stored after the write (current stored bytes plus incoming bytes), and returns a MaybeAsync boolean: true to allow the write, or false to deny it due to quota limits. The callback can be synchronous (for SQLite or in-memory checks) or asynchronous (for calling remote APIs). The callback returns a boolean rather than an error because error handling and logging are the responsibility of the callback implementation. ### Example // Client // evolu.subscribeError // Relay isOwnerWithinQuota: (ownerId, requiredBytes) => { console.log(ownerId, requiredBytes); // Check error via evolu.subscribeError return true; }; | RelayConfig.isOwnerWithinQuota | common/dist/src/local-first/Storage.d.ts:40 |
name? | readonly | string & Brand<"UrlSafeString"> & Brand<"SimpleName"> | The relay name. Implementations can use this for identification purposes (e.g., database file name, logging). | RelayConfig.name | common/dist/src/local-first/Relay.d.ts:18 |
port? | readonly | number | The port number for the HTTP server. | - | nodejs/src/local-first/Relay.ts:37 |