Open
Conversation
uWebSockets doesn't provide client support.
Also include nostr.hpp in gitrepublic.h and ensure the whole project builds successfully.
- Set up the nostr namespace as a library named gitrepublic-ndk. - Add GTest to the project. - Fix build errors.
- Rename NostrUtils -> NostrService - Define interface IWebSocketClient - NostrService only interacts with WebSocket protocol via the IWebSocketClient interface - NostrService accepts a client instance in its constructor - Create an IWebSocketClient implementation based on WebSocket++
- Create a mock implementation of IWebSocket client to use in unit tests for the NostrService class. - Fetch and build Google Test via CMake to ensure it uses the same compiler settings and targets as the project it is testing.
Silberengel
reviewed
Feb 26, 2024
Silberengel
reviewed
Feb 26, 2024
| // Configure the connection here via the connection pointer. | ||
| connection->set_fail_handler([this, uri](auto handle) { | ||
| // PLOG_ERROR << "Error connecting to relay " << relay << ": Handshake failed."; | ||
| lock_guard<mutex> lock(this->_propertyMutex); |
There was a problem hiding this comment.
isConnected also locks the mutex - I assume it works, but the lock_guard could be placed inside the if
Silberengel
reviewed
Feb 26, 2024
| for (string relay : unconnectedRelays) | ||
| { | ||
| thread connectionThread([this, relay]() { | ||
| this->connect(relay); |
There was a problem hiding this comment.
What happens if this fails? Not sure if that's possible or already covered in the function itself.
Silberengel
reviewed
Feb 26, 2024
|
|
||
| void Event::deserialize(string jsonString) | ||
| { | ||
| nlohmann::json j = nlohmann::json::parse(jsonString); |
There was a problem hiding this comment.
I think .at() would be more safe than the index (even if it is very controlled here). Maybe you could also check out serialization https://github.com/nlohmann/json?tab=readme-ov-file#serialization--deserialization
- Add unit tests for some of the methods of `NostrService`. - Explicitly declare specific usings rather than entire namespaces (e.g., don't to `using namespace std;`). - Add some additional logging with Plog.
buttercat1791
added a commit
to ShadowySupercode/aedile-ndk
that referenced
this pull request
Mar 3, 2024
- Port existing work over from ShadowySupercode/gitrepublic-core#2 - Adjust project layout and configure CMake scripts accordingly
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR adds a
nostrnamespace to the project that defines a Nostr client, built using WebSocket++ and nlohmann/json.Notes for Reviewer