hummingbird-project / hummingbird-websocket

Websocket upgrade support for Hummingbird
Apache License 2.0
35 stars 6 forks source link

An update included in 2.0.0-rc.2 constrains use to macOS 15 & greater, which isn't yet released #75

Closed heckj closed 1 week ago

heckj commented 2 weeks ago

I saw the 2.0.0-rc2 release sequence and tried it out this morning on a small project of mine. I'm not yet using macOS 15, since it's not yet released - so this really stumbles my use of this framework.

When I grab a fresh checkout of this repo and run swift test, I get the following error:

/Users/heckj/src/hummingbird-websocket/Sources/HummingbirdWSCore/WebSocketHandler.swift:183:65: error: 'next(isolation:)' is only available in macOS 15.0 or newer
 54 | /// Manages ping, pong and close messages. Collates data and text messages into final frame
 55 | /// and passes them onto the ``WebSocketDataHandler`` data handler setup by the user.
 56 | package actor WebSocketHandler {
    |               `- note: add @available attribute to enclosing actor
 57 |     enum InternalError: Error {
 58 |         case close(WebSocketErrorCode)
    :
153 |     }
154 |
155 |     func handle<Context: WebSocketContext>(
    |          `- note: add @available attribute to enclosing instance method
156 |         inbound: NIOAsyncChannelInboundStream<WebSocketFrame>,
157 |         outbound: NIOAsyncChannelOutboundWriter<WebSocketFrame>,
    :
181 |                     // Close handshake. Wait for responding close or until inbound ends
182 |                     #if compiler(>=6.0)
183 |                     while let frame = try await inboundIterator.next(isolation: self) {
    |                                                                 |- error: 'next(isolation:)' is only available in macOS 15.0 or newer
    |                                                                 `- note: add 'if #available' version check
184 |                         if case .connectionClose = frame.opcode {
185 |                             try await self.receivedClose(frame)

When I compile using Swift 5.10, it spews the expected warnings, but works without issue. Because of this, I think it might be worthwhile to note in the release notes that if you're compiling with Swift 6, you'll also need to be running macOS 15. Unless there's some path to using this that doesn't have an availability lock with the latest OS release.

Mostly, I'd recommend a note about specifically compiling with Swift 5.10 while using this locally until the latest macOS release is generally available.

adam-fowler commented 2 weeks ago

I can probably add a #if available around it but it might mean swift 6 doesn't compile. I'll have to check.

adam-fowler commented 2 weeks ago

Otherwise we'll just have to remove support for compiling in Swift 6 mode.

adam-fowler commented 2 weeks ago

Added PR #77 that fixes this. I got around the swift 6 error in a different way