vapor / websocket-kit

WebSocket client library built on SwiftNIO
https://docs.vapor.codes/4.0/advanced/websockets/
MIT License
272 stars 79 forks source link

Add support for proxying in `WebsocketClient` #130

Closed rnro closed 1 year ago

rnro commented 1 year ago

Added support for TLS and plain text proxying of Websocket traffic.

This change also includes some performance gains by reducing the allocation and copies necessary to send ByteBuffer and ByteBufferView through WebSocket.send.

rnro commented 1 year ago

Thanks for the review @0xTim. I've pushed the changes you requested and also some performance improvements in a separate commit.

codecov-commenter commented 1 year ago

Codecov Report

Merging #130 (777ef32) into main (e0faccd) will decrease coverage by 3.62%. The diff coverage is 78.80%.

Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #130 +/- ## ========================================== - Coverage 71.15% 67.54% -3.62% ========================================== Files 5 6 +1 Lines 475 758 +283 ========================================== + Hits 338 512 +174 - Misses 137 246 +109 ``` | [Impacted Files](https://codecov.io/gh/vapor/websocket-kit/pull/130?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=vapor) | Coverage Δ | | |---|---|---| | [...bSocketKit/Concurrency/WebSocket+Concurrency.swift](https://codecov.io/gh/vapor/websocket-kit/pull/130?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=vapor#diff-U291cmNlcy9XZWJTb2NrZXRLaXQvQ29uY3VycmVuY3kvV2ViU29ja2V0K0NvbmN1cnJlbmN5LnN3aWZ0) | `29.78% <ø> (ø)` | | | [Sources/WebSocketKit/WebSocket+Connect.swift](https://codecov.io/gh/vapor/websocket-kit/pull/130?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=vapor#diff-U291cmNlcy9XZWJTb2NrZXRLaXQvV2ViU29ja2V0K0Nvbm5lY3Quc3dpZnQ=) | `50.00% <36.84%> (-47.50%)` | :arrow_down: | | [Sources/WebSocketKit/WebSocket.swift](https://codecov.io/gh/vapor/websocket-kit/pull/130?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=vapor#diff-U291cmNlcy9XZWJTb2NrZXRLaXQvV2ViU29ja2V0LnN3aWZ0) | `72.87% <77.41%> (+1.09%)` | :arrow_up: | | [...urces/WebSocketKit/HTTPUpgradeRequestHandler.swift](https://codecov.io/gh/vapor/websocket-kit/pull/130?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=vapor#diff-U291cmNlcy9XZWJTb2NrZXRLaXQvSFRUUFVwZ3JhZGVSZXF1ZXN0SGFuZGxlci5zd2lmdA==) | `72.05% <77.77%> (ø)` | | | [Sources/WebSocketKit/WebSocketHandler.swift](https://codecov.io/gh/vapor/websocket-kit/pull/130?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=vapor#diff-U291cmNlcy9XZWJTb2NrZXRLaXQvV2ViU29ja2V0SGFuZGxlci5zd2lmdA==) | `61.97% <85.18%> (+6.65%)` | :arrow_up: | | [Sources/WebSocketKit/WebSocketClient.swift](https://codecov.io/gh/vapor/websocket-kit/pull/130?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=vapor#diff-U291cmNlcy9XZWJTb2NrZXRLaXQvV2ViU29ja2V0Q2xpZW50LnN3aWZ0) | `86.00% <90.55%> (+18.03%)` | :arrow_up: |
rnro commented 1 year ago

Sorry about the delay. The missing DocC comments should now be there.

VaporBot commented 1 year ago

These changes are now available in 2.8.0

0xTim commented 1 year ago

FYI nightly error is being tracked at https://github.com/apple/swift/issues/65064