Skip to content

Conversation

@tcheeric
Copy link
Owner

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 feature
  • docs - Documentation only
  • test - Adding or updating tests
  • perf - Performance improvement
  • chore - Build, CI, or tooling changes

What changed?

  • Added support for configurable WebSocket buffer sizes via system properties:
    • 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)
  • Updated tests to validate buffer size configurations and message timeout.
  • Updated project and module versions to 1.3.0.

Breaking changes

None.

Testing

  • Unit tests pass: mvn test
  • Integration tests pass: mvn verify (requires Docker)

Review focus

  • Are buffer size defaults reasonable for expected use cases?
  • Are the system property keys and descriptions intuitive for configuration?

Checklist

  • PR title follows conventional commits: type(scope): description
  • Changes are focused and under 300 lines (or stacked PRs)
  • Tests added/updated for new functionality
  • No new compiler warnings introduced
  • CHANGELOG.md updated (for user-facing changes)

tcheeric and others added 3 commits January 25, 2026 18:02
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>
Copy link

@chatgpt-codex-connector chatgpt-codex-connector bot left a 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".

Copy link
Contributor

Copilot AI left a 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 underlying WebSocketContainer with customizable idle timeout and text/binary buffer sizes via system properties, with 1 MB defaults for large Nostr events (e.g., NIP-60).
  • Add StandardWebSocketClientMultiMessageTest to 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.1 to 1.3.0 and document the 1.3.0 release in CHANGELOG.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.

Copy link

Copilot AI commented Jan 25, 2026

@tcheeric I've opened a new pull request, #506, to work on those changes. Once the pull request is ready, I'll request review from you.

tcheeric and others added 3 commits January 25, 2026 21:21
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Copy link

Copilot AI commented Jan 25, 2026

@tcheeric I've opened a new pull request, #507, to work on those changes. Once the pull request is ready, I'll request review from you.

Copy link

Copilot AI commented Jan 25, 2026

@tcheeric I've opened a new pull request, #508, to work on those changes. Once the pull request is ready, I'll request review from you.

Copy link

Copilot AI commented Jan 25, 2026

@tcheeric I've opened a new pull request, #509, to work on those changes. Once the pull request is ready, I'll request review from you.

tcheeric and others added 5 commits January 25, 2026 21:23
[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
@tcheeric tcheeric requested a review from Copilot January 25, 2026 21:29
@tcheeric tcheeric merged commit 6e344b3 into develop Jan 25, 2026
8 of 9 checks passed
@tcheeric tcheeric deleted the fix/relay-default-values branch January 25, 2026 21:34
Copy link
Contributor

Copilot AI left a 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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants