-
Notifications
You must be signed in to change notification settings - Fork 27
Add configurable WebSocket buffer sizes for large Nostr events #505
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
Conversation
Configure WebSocketContainer with larger text/binary message buffer sizes (default 1MB each) to handle NIP-60 wallet state events and other large Nostr events that exceed default buffer sizes. Buffer sizes are now configurable via system properties: - nostr.websocket.max-idle-timeout-ms (default: 3600000) - nostr.websocket.max-text-message-buffer-size (default: 1048576) - nostr.websocket.max-binary-message-buffer-size (default: 1048576) This fixes 1009 "message too big" errors that caused WebSocket disconnections when receiving large events from relays. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Projects updated: - nostr-java: 1.2.1 → 1.3.0 (minor) - All modules updated to match parent version Changes include: - Added configurable WebSocket buffer sizes for large Nostr events - Improved Kind enum with safer lookup methods - Fixed thread-safety in WebSocket client send() - Fixed fail-fast deserialization in KindFilter Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
…StandardWebSocketClient
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: aed3adfaff
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
...ient/src/test/java/nostr/client/springwebsocket/StandardWebSocketClientMultiMessageTest.java
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR introduces configurable WebSocket container buffer sizes for handling large Nostr events and bumps the project to version 1.3.0, along with additional tests for StandardWebSocketClient.
Changes:
- Configure
StandardWebSocketClient’s underlyingWebSocketContainerwith customizable idle timeout and text/binary buffer sizes via system properties, with 1 MB defaults for large Nostr events (e.g., NIP-60). - Add
StandardWebSocketClientMultiMessageTestto verify accumulation of multiple relay messages, termination handling (EOSE/OK), and timeout behavior; retain and reuse existing timeout/subscription tests. - Bump the root and module POM versions from
1.2.1to1.3.0and document the 1.3.0 release inCHANGELOG.md.
Reviewed changes
Copilot reviewed 13 out of 13 changed files in this pull request and generated 6 comments.
Show a summary per file
| File | Description |
|---|---|
pom.xml |
Bumps the parent artifact version to 1.3.0, defining the new release version. |
nostr-java-util/pom.xml |
Aligns the util module with parent version 1.3.0. |
nostr-java-id/pom.xml |
Aligns the id module with parent version 1.3.0. |
nostr-java-examples/pom.xml |
Aligns the examples module with parent version 1.3.0. |
nostr-java-event/pom.xml |
Aligns the event module with parent version 1.3.0. |
nostr-java-encryption/pom.xml |
Aligns the encryption module with parent version 1.3.0. |
nostr-java-crypto/pom.xml |
Aligns the crypto module with parent version 1.3.0. |
nostr-java-base/pom.xml |
Aligns the base module with parent version 1.3.0. |
nostr-java-api/pom.xml |
Aligns the API module with parent version 1.3.0. |
nostr-java-client/pom.xml |
Aligns the client module with parent version 1.3.0. |
nostr-java-client/src/main/java/nostr/client/springwebsocket/StandardWebSocketClient.java |
Adds default text/binary buffer size constants, extends createSpringClient to read idle-timeout and buffer sizes from system properties, configures the WebSocketContainer accordingly, and logs the effective settings. |
nostr-java-client/src/test/java/nostr/client/springwebsocket/StandardWebSocketClientMultiMessageTest.java |
New tests verifying that StandardWebSocketClient.send accumulates multiple EVENTs until EOSE, completes immediately on OK, and times out when EOSE never arrives. |
CHANGELOG.md |
Adds a 1.3.0 entry documenting configurable WebSocket buffer sizes and (re)lists earlier Kind-related behavior, but with some property-name and duplication issues called out in review comments. |
nostr-java-client/src/main/java/nostr/client/springwebsocket/StandardWebSocketClient.java
Show resolved
Hide resolved
...ient/src/test/java/nostr/client/springwebsocket/StandardWebSocketClientMultiMessageTest.java
Show resolved
Hide resolved
...ient/src/test/java/nostr/client/springwebsocket/StandardWebSocketClientMultiMessageTest.java
Show resolved
Hide resolved
...ient/src/test/java/nostr/client/springwebsocket/StandardWebSocketClientMultiMessageTest.java
Show resolved
Hide resolved
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
[WIP] Update configurable WebSocket buffer sizes based on feedback
[WIP] Apply feedback from review on configurable WebSocket buffer sizes
[WIP] Update configurable WebSocket buffer sizes for Nostr events
[WIP] Update configurable WebSocket buffer sizes for Nostr events
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
Copilot reviewed 14 out of 14 changed files in this pull request and generated no new comments.
Summary
This pull request introduces configurable WebSocket buffer sizes to handle large Nostr events, such as NIP-60 wallet state events, which previously exceeded default buffer sizes and caused disconnections. Defaults are set to accommodate typical large event sizes while remaining customizable via system properties.
Type of change
fix- Bug fix (non-breaking)feat- New feature (non-breaking)refactor- Code change that neither fixes a bug nor adds a featuredocs- Documentation onlytest- Adding or updating testsperf- Performance improvementchore- Build, CI, or tooling changesWhat changed?
nostr.websocket.max-idle-timeout-ms(default: 1 hour)nostr.websocket.max-text-message-buffer-size(default: 1MB)nostr.websocket.max-binary-message-buffer-size(default: 1MB)1.3.0.Breaking changes
None.
Testing
mvn testmvn verify(requires Docker)Review focus
Checklist
type(scope): description