applesauce-relay 0.0.0-next-20250725170333 → 0.0.0-next-20250726160247

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/relay.d.ts CHANGED
@@ -9,6 +9,9 @@ export declare class ReqCloseError extends Error {
9
9
  }
10
10
  export type RelayOptions = {
11
11
  WebSocket?: WebSocketSubjectConfig<any>["WebSocketCtor"];
12
+ eoseTimeout?: number;
13
+ eventTimeout?: number;
14
+ keepAlive?: number;
12
15
  };
13
16
  export declare class Relay implements IRelay {
14
17
  url: string;
@@ -53,11 +56,11 @@ export declare class Relay implements IRelay {
53
56
  get authenticated(): boolean;
54
57
  get authenticationResponse(): PublishResponse | null;
55
58
  get information(): RelayInformation | null;
56
- /** If an EOSE message is not seen in this time, emit one locally */
59
+ /** If an EOSE message is not seen in this time, emit one locally (default 10s) */
57
60
  eoseTimeout: number;
58
- /** How long to wait for an OK message from the relay */
61
+ /** How long to wait for an OK message from the relay (default 10s) */
59
62
  eventTimeout: number;
60
- /** How long to keep the connection alive after nothing is subscribed */
63
+ /** How long to keep the connection alive after nothing is subscribed (default 30s) */
61
64
  keepAlive: number;
62
65
  protected receivedAuthRequiredForReq: BehaviorSubject<boolean>;
63
66
  protected receivedAuthRequiredForEvent: BehaviorSubject<boolean>;
package/dist/relay.js CHANGED
@@ -66,11 +66,11 @@ export class Relay {
66
66
  get information() {
67
67
  return this._nip11;
68
68
  }
69
- /** If an EOSE message is not seen in this time, emit one locally */
69
+ /** If an EOSE message is not seen in this time, emit one locally (default 10s) */
70
70
  eoseTimeout = 10_000;
71
- /** How long to wait for an OK message from the relay */
71
+ /** How long to wait for an OK message from the relay (default 10s) */
72
72
  eventTimeout = 10_000;
73
- /** How long to keep the connection alive after nothing is subscribed */
73
+ /** How long to keep the connection alive after nothing is subscribed (default 30s) */
74
74
  keepAlive = 30_000;
75
75
  // Subjects that track if an "auth-required" message has been received for REQ or EVENT
76
76
  receivedAuthRequiredForReq = new BehaviorSubject(false);
@@ -96,6 +96,13 @@ export class Relay {
96
96
  constructor(url, opts) {
97
97
  this.url = url;
98
98
  this.log = this.log.extend(url);
99
+ // Set common options
100
+ if (opts?.eoseTimeout !== undefined)
101
+ this.eoseTimeout = opts.eoseTimeout;
102
+ if (opts?.eventTimeout !== undefined)
103
+ this.eventTimeout = opts.eventTimeout;
104
+ if (opts?.keepAlive !== undefined)
105
+ this.keepAlive = opts.keepAlive;
99
106
  // Create an observable that tracks boolean authentication state
100
107
  this.authenticated$ = this.authenticationResponse$.pipe(map((response) => response?.ok === true));
101
108
  /** Use the static method to create a new reconnect method for this relay */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "applesauce-relay",
3
- "version": "0.0.0-next-20250725170333",
3
+ "version": "0.0.0-next-20250726160247",
4
4
  "description": "nostr relay communication framework built on rxjs",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -54,14 +54,14 @@
54
54
  },
55
55
  "dependencies": {
56
56
  "@noble/hashes": "^1.7.1",
57
- "applesauce-core": "0.0.0-next-20250725170333",
57
+ "applesauce-core": "0.0.0-next-20250726160247",
58
58
  "nanoid": "^5.0.9",
59
59
  "nostr-tools": "^2.13",
60
60
  "rxjs": "^7.8.1"
61
61
  },
62
62
  "devDependencies": {
63
63
  "@hirez_io/observer-spy": "^2.2.0",
64
- "applesauce-signers": "0.0.0-next-20250725170333",
64
+ "applesauce-signers": "0.0.0-next-20250726160247",
65
65
  "@vitest/expect": "^3.1.1",
66
66
  "typescript": "^5.7.3",
67
67
  "vitest": "^3.2.3",