Re-organize connection management
This commit is contained in:
@@ -4,22 +4,24 @@ Another nostr toolkit, focused on creating highly a configurable client system.
|
||||
|
||||
# Utilities
|
||||
|
||||
- [Deferred](./src/Deferred.ts') is just a promise with `resolve` and `reject` methods.
|
||||
- [EventBus](./src/EventBus.ts') is an implementation of an event bus.
|
||||
- [Socket](./src/Socket.ts') is a wrapper around isomorphic-ws that handles connection status and json parsing/serialization.
|
||||
- [Deferred](./src/utils/Deferred.ts') is just a promise with `resolve` and `reject` methods.
|
||||
- [Socket](./src/utils/Socket.ts') is a wrapper around isomorphic-ws that handles json parsing/serialization.
|
||||
- [Queue](./src/utils/Queue.ts') is an implementation of an asynchronous queue.
|
||||
|
||||
# Components
|
||||
|
||||
- [Pool](./src/Pool.ts') is a thin wrapper around `Map` for use with `Relay`s.
|
||||
- [Connection](./src/Connection.ts') is a wrapper for `Socket` with send and receive queues, and a `ConnectionMeta` instance.
|
||||
- [ConnectionMeta](./src/ConnectionMeta.ts') tracks stats for a given `Connection`.
|
||||
- [Executor](./src/Executor.ts') implements common nostr flows on `target`
|
||||
- [Pool](./src/Pool.ts') is a thin wrapper around `Map` for use with `Relay`s.
|
||||
|
||||
# Executor targets
|
||||
|
||||
Executor targets have an event `bus`, a `send` method, a `cleanup` method, and are passed to an `Executor` for use.
|
||||
|
||||
- [Relay](./src/Relay.ts') takes a `Socket` and provides listeners for different verbs.
|
||||
- [Relays](./src/Relays.ts') takes an array of `Socket`s and provides listeners for different verbs, merging all events into a single stream.
|
||||
- [Plex](./src/Plex.ts') takes an array of urls and a `Socket` and sends and receives wrapped nostr messages over that connection.
|
||||
- [Relay](./src/Relay.ts') takes a `Connection` and provides listeners for different verbs.
|
||||
- [Relays](./src/Relays.ts') takes an array of `Connection`s and provides listeners for different verbs, merging all events into a single stream.
|
||||
- [Plex](./src/Plex.ts') takes an array of urls and a `Connection` and sends and receives wrapped nostr messages over that connection.
|
||||
|
||||
# Example
|
||||
|
||||
|
||||
Reference in New Issue
Block a user