websocket-kit icon indicating copy to clipboard operation
websocket-kit copied to clipboard

Changed type of send(_ binary:) from `[UInt8]` to `some DataProtocol`

Open fizker opened this issue 1 year ago • 3 comments

This allows for passing in Data or ByteBufferView to send(_:), as well as the currently-supported [UInt8] type.

fizker avatar Jan 04 '24 18:01 fizker

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Project coverage is 82.85%. Comparing base (a935b63) to head (8d2d799). Report is 2 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #146   +/-   ##
=======================================
  Coverage   82.85%   82.85%           
=======================================
  Files           6        6           
  Lines         659      659           
=======================================
  Hits          546      546           
  Misses        113      113           
Files Coverage Δ
Sources/WebSocketKit/WebSocket.swift 89.04% <100.00%> (ø)

codecov-commenter avatar Jan 04 '24 18:01 codecov-commenter

This pull request sets up GitHub code scanning for this repository. Once the scans have completed and the checks have passed, the analysis results for this pull request branch will appear on this overview. Once you merge this pull request, the 'Security' tab will show more code scanning analysis results (for example, for the default branch). Depending on your configuration and choice of analysis tool, future pull requests will be annotated with code scanning analysis results. For more information about GitHub code scanning, check out the documentation.

Regarding the failing test, it reacts to the change of type. But since [UInt8] conforms to DataProtocol (which for the record is protocol DataProtocol : RandomAccessCollection where Self.Element == UInt8, Self.SubSequence : DataProtocol), I am not sure it actually is a breaking change?

fizker avatar Jan 04 '24 19:01 fizker

Why wasn't this changed in the Concurrency shims as well?

https://github.com/vapor/websocket-kit/blob/4232d34efa49f633ba61afde365d3896fc7f8740/Sources/WebSocketKit/Concurrency/WebSocket%2BConcurrency.swift#L15

gregcotten avatar Mar 27 '24 20:03 gregcotten

Probably just an oversight tbh

0xTim avatar Mar 30 '24 13:03 0xTim

Why wasn't this changed in the Concurrency shims as well?

https://github.com/vapor/websocket-kit/blob/4232d34efa49f633ba61afde365d3896fc7f8740/Sources/WebSocketKit/Concurrency/WebSocket%2BConcurrency.swift#L15

I didn't know that overload existed until you told me about it. I stumbled on the one I changed and didn't look further as it did what I wanted 🤷.

fizker avatar Apr 01 '24 23:04 fizker