This CL adds documentation for `WebSocket.addError` to clarify that it does not transmit error events to the remote peer and only reports them locally.
The change addresses confusion described in dart-lang/sdk#45733.
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
| Code-Review | +1 |
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
Nice clarification!
/// The error is reported locally and is not transmitted to the peer.What does this mean exactly? How does the error get reported? Do we have a test for this that you could point me to?
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
/// The error is reported locally and is not transmitted to the peer.What does this mean exactly? How does the error get reported? Do we have a test for this that you could point me to?
As WebSocket itself implements both Stream and StreamSink, addError() reports the error through the Dart’s normal stream/event-sink error propagation mechanism
via _eventSink!.addError(error, stackTrace);
as found in sdk\lib\_http\websocket_impl.dart,
instead of reporting it through a separate network/protocol-level error channel.
and also any listeners attached to that same WebSocket instance via listen(onError:),can receive the error event locally.
Test files that inspected:
1) web_socket_error_test.dart
tests connection/protocol/socket failures
2) web_socket_test.dart
tests messaging, close handling, upgrades, etc.
as well as several other websocket-related tests under sdk/tests/standalone/io/, but I could not find any tests specifically covering WebSocket.addError() behaviour.
Probably as it uses Dart's internal error propagation mechanism,this behaviour is already covered by stream tests elsewhere.
Also Would you like me to update documentation to make it more precise?
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |