Commit Graph

24 Commits

Author SHA1 Message Date
Tristan B. Velloza Kildaire 8774e1f866 Dub
- Upgraded `gogga` to version `2.1.16`
2023-03-04 14:37:50 +02:00
Tristan B. Velloza Kildaire 22c2276a70 - Use new logger 2023-03-02 16:41:29 +02:00
Tristan B. Velloza Kildaire 9fa2a9b1d7 Logging
- Typo fix
2023-02-28 08:52:38 +02:00
Tristan B. Velloza Kildaire 37cba46ad1 App
- Removed unneeded `writeln(string)` call
- Call `runApplication()` after all setup to hang on event loop
2023-02-28 08:51:56 +02:00
Tristan B. Velloza Kildaire cb0e4ad201 Relays
- Fixed bug in `ensureConnection()` whereby a new `WebSocket` was being created whenever `ws is null` was `false
2023-02-28 08:48:57 +02:00
Tristan B. Velloza Kildaire 46dc74cc08 Messages
- Moved definition of `NostrMessage` into `messages` module
- Moved definition of `NostrEvent` into `messages` module

App

- Use `dnostr.messages` module

Client

- Use `dnostr.messages` module

Listener

- Use `dnostr.messages` module

Relays

- Use `dnostr.messages` module
2023-02-28 08:47:20 +02:00
Tristan B. Velloza Kildaire 2b26e30ca1 Logging
- Added re-usable template mixin `LoggerSetup` to setup a logger and enable the debugging mode when the `-ddbg` flag is used during build time

Client

- Use `LoggerSetup`

Relays

- Use `LoggerSetup`

Ap

- Use `LoggerSetup`
2023-02-28 08:42:10 +02:00
Tristan B. Velloza Kildaire 03be95be22 Client
- Now `call()` the `NostrRelay` fiber to start it

NostrRelay

- Re-working into a fiber
- Working on a new `ensureConnection()`
- Removed old code
2023-02-28 08:39:30 +02:00
Tristan B. Velloza Kildaire 43bff86840 App
- Added some testing relays
- Construct a new `NostrCLient` instance with `relay1`
- Post an event

NostrClient

- Constructor now takes in an array of  `NostrRelay`s
- Implemented `goOnline()` which locks the relay list, starts each relay and unlocks the relay list
- Renamed `post(NostrPost)` to `event(NostrEVent)`
- Removed `createPost()`
- `NostrEvent` -> `NostrMessage` and `NostrPost` -> `NostrEvent`
- Updated `NostrEvent`'s `publicKey to `private`
- Updated `NostrEvent`'s constructor to `public`
- Added `serialize()` override

Relays

- Reconnections are still broken
- Added `connLock` to lock the web socket when dealing with reconections
- Overhauled the `attemptConnection(int)` code
- Added `setListener()`
- Ensured that `unsubcribe()`, `subscribe()` and `event()` all call `ensureConnected()` first
- `event(NostrMessage)` now sends the JSON

Listener

- Added `NostrListener` interface
2023-02-22 12:05:19 +02:00
Tristan B. Velloza Kildaire 237d55c028 NostrRelay
- Adjusted reconnect time to five seconds
2023-02-21 19:54:42 +02:00
Tristan B. Velloza Kildaire f1945ae322 Updated .gitignore 2023-02-21 19:51:48 +02:00
Tristan B. Velloza Kildaire 6572650e70 App
- Removed call to `runApplication()` which would cause weird behaviour regarding threading/processes and their master/leader
2023-02-21 19:51:24 +02:00
Tristan B. Velloza Kildaire 098f1bd143 NostrRelay
- Fixed another bug in `attemptConnection()` which if the exception failed then `ws` would be unitinitialized and `null`
2023-02-21 19:49:44 +02:00
Tristan B. Velloza Kildaire c3f3872e20 NostrRelay
- Fixed relay reconnect logic by catching deadline exceeded excweption
2023-02-21 19:46:15 +02:00
Tristan B. Velloza Kildaire 98bea6ed69 NostrRelay
- Added mutex for relay list
2023-02-21 19:34:29 +02:00
Tristan B. Velloza Kildaire ba4eaff936 NostrRelay
- Me thinks me is dumb
2023-02-21 18:15:40 +02:00
Tristan B. Velloza Kildaire e5eae92dee NostrRelay
- Debug print that we are attempting to connect
2023-02-21 18:03:02 +02:00
Tristan B. Velloza Kildaire 15cf80ba7c DUB
- Added `gogga` as  depdendency

App

- Now using the `gogga` library for logging

NostrRelay

- Now using the `gogga` library for logging
- Added a connect timeout
2023-02-21 17:59:32 +02:00
Tristan B. Velloza Kildaire 61ada70660 NostrRelay
- Fixed compilation issue
2023-02-21 16:59:15 +02:00
Tristan B. Velloza Kildaire 97fa878f2e NostrRelay
- `event()` now is `event(NostrEvent)` and takes in the event

NostrClient

- When running through relays to make a post call `relay.event(post)` with the post to post to said relay
2023-02-21 16:58:39 +02:00
Tristan B. Velloza Kildaire f482175b03 NostrRelay
- Moved handling code into `handler(string)`
- Now waits until disconnectedc or data arrived, in case of disconnect, try reconnect)
2023-02-21 16:55:39 +02:00
Tristan B. Velloza Kildaire e0afabfd29 NostrRelay
- Refactored into `untilConnected()`
2023-02-21 16:52:56 +02:00
Tristan B. Velloza Kildaire cf4b6552e5 NostrRelay
- Added skeleton code for a nostr relay which will attempt to reconnect till a connection is achieved on the first try

NostrClient

- Represents a nostr client with a list of relays and associated cryptographic keys

NostrPost

- Represents a post

App

- Added some testing code to test web sockets
2023-02-21 16:42:49 +02:00
Tristan B. Velloza Kildaire 766b20cbc6 Initial commit 2023-02-21 16:14:46 +02:00