Email or username:

Password:

Forgot your password?
Alex Gleason
Here is my new Nostr relay library: https://doc.deno.land/https://gitlab.com/soapbox-pub/nostr-machina/-/raw/main/mod.ts

https://gitlab.com/soapbox-pub/nostr-machina

It's still experimental and doesn't support a pool yet. But it's comprised of a bunch of useful utilities that makes working with WebSockets and Nostr easier.
2 comments
Alex Gleason
The file probably most useful to everybody is this: https://gitlab.com/soapbox-pub/nostr-machina/-/blob/main/src/async-socket.ts

Async open, async close. Messages stream. Things that should just be in the WebSocket default.

Also, socket auto-reconnect with exponential backoff, as a pure function: https://gitlab.com/soapbox-pub/nostr-machina/-/blob/main/src/reanimate.ts
The file probably most useful to everybody is this: https://gitlab.com/soapbox-pub/nostr-machina/-/blob/main/src/async-socket.ts

Async open, async close. Messages stream. Things that should just be in the WebSocket default.
Alex Gleason
The RelayPool I'm working on is a stripped down pool whose only job is to keep a group of WebSocket connections alive. It does not facilitate messaging. This is the correct abstraction, because you can then pass RelayPool instances into other functions who add the messaging layers on top, allowing you to keep one pool without duplicate connections.

The RelayPool is an EventTarget with "add", "remove", and "reconnect" events, so you can build anything on top of it.
The RelayPool I'm working on is a stripped down pool whose only job is to keep a group of WebSocket connections alive. It does not facilitate messaging. This is the correct abstraction, because you can then pass RelayPool instances into other functions who add the messaging layers on top, allowing you to keep one pool without duplicate connections.
Go Up