forked from tcheeric/nostr-java
-
Notifications
You must be signed in to change notification settings - Fork 2
NIP52 + Spring WebSocketClient #2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Closed
Closed
Conversation
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
…Factory added required arrayNode item "subscriptionId" to EventMessage encoder fixed CanonicalAuthenticationMessage decoder
…ance to use and since the client API doesn't directly support relay responses, i've added a small/simple/useful client implementation leveraging springframework WebSocketClient atop reactive-streams, composed of 4 parts: implementation: 1) dependencies added to nostr-java-api pom.xml: springframework dependencies: spring-websocket spring-webflux and reactor dependency: reactor-netty-http 2) small/simple WebSocketClient reference implementation, in files: nostr-java-client/src/main/java/nostr/client/springwebsocket/SpringWebSocketClient.java nostr-java-client/src/main/java/nostr/client/springwebsocket/WebSocketClient.java nostr-java-client/src/main/java/nostr/client/springwebsocket/WebSocketHandler.java 3) minimal/tiny changes to current codebase for spring websocketclient integration - class Nostr public method signatures cloned into interface NostrIF - class Nostr now implements NostrIF - added class NostrSpringWebSocketClient, also implements NostrIF (this class wraps Spring WebSocketClient reference implementation mentioned above) 4) class EventNostr formerly: public abstract class EventNostr<T extends GenericEvent> extends Nostr now public abstract class EventNostr<T extends GenericEvent> extends NostrSpringWebSocketClient all remaining nostr-java classes/heirarchiess/calls/etc remain unchanged testing: 2) ApiEventTest methods that send events to relay have been supplemented with callback logic, i.e.,: await().until(() -> Objects.nonNull(nip01.getRelayResponse())); nip01.close();
…d json correctness
…viously returned <T extends GenericEvent>) - Nostr send() methods should (and now do) return List<String> (previously returned void) - NostrIF send() method signatures should (and now do) return List<String> (previously returned void) - introduced two (per developer's need/choice) web socket clients: ReactiveWebSocketClient SpringWebSocketClient - added ClassifiedListingEvent mapping logic for it's contained ClassifiedListing - added addStandardTag() mapping methods to GenericEvent - added constructor GenericEventDecoder(Class<T> clazz) to GenericEventDecoder - updated unit tests per above changes
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.
hi, eric. i'm using this PR (submitted exclusively against my fork of nostr-relay) as an convenient way to discuss an alternative nostr.api.Nostr (client) implementation. given nostr.api.Nostr complexity/nuance to use and since neither the client API nor tests include an easy way to accommodate relay responses, perhaps you might be interested to see a small/simple/useful client implementation leveraging springframework WebSocketClient atop webflux/reactive-streams, composed of 4 parts:
implementation:
springframework dependencies:
and reactor dependency:
updated to:
with all remaining nostr-java classes/heirarchiess/calls/etc unchanged.
testing:
again, this PR isn't intended for approval but rather a convenient way to demonstrate minimal code updates for an alternate (and modern) websocketclient + reactive-stream implementation, should you find value/usefulness/etc in it.