Skip to content

Honor receive message completion - #69

Open
mike-at-legend wants to merge 1 commit into
pusher:mainfrom
mike-at-legend:agent/honor-receive-message-completion
Open

Honor receive message completion#69
mike-at-legend wants to merge 1 commit into
pusher:mainfrom
mike-at-legend:agent/honor-receive-message-completion

Conversation

@mike-at-legend

Copy link
Copy Markdown

What changed

  • Read the isComplete value from NWConnection.receiveMessage.
  • Send received data to the delegate only when the message is complete.
  • Add tests for complete, incomplete, empty, and missing-context receive values.

Why

The receive loop ignored isComplete and sent non-empty data to the delegate before it handled a transport error.

NWConnection can return partial data with isComplete == false when a receive ends with an error. A text delegate could receive that partial data as a complete UTF-8 or JSON message.

The error path does not change. It still reports the transport failure and stops the receive loop.

Impact

Clients no longer receive incomplete WebSocket data as a complete message.

Validation

  • swift test
  • 11 tests passed with 0 failures.

Fixes #68.

@mike-at-legend
mike-at-legend marked this pull request as ready for review August 10, 2026 21:32
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.

Incomplete receive data is delivered as a complete WebSocket message

1 participant