emqx / CocoaMQTT

MQTT 5.0 client library for iOS and macOS written in Swift
https://www.emqx.com/en
Other
1.57k stars 411 forks source link

Impossibile compiling due to Starscream 4.0.6 #558

Open manfredipist opened 8 months ago

manfredipist commented 8 months ago

I can no longer compile the app as CocoaMQTT is downloading as incompatible version of Starscream (4.0.6) through Swift Package Manager

CocoaMQTT/Source/CocoaMQTTWebSocket.swift:459:1 Type 'CocoaMQTTWebSocket.StarscreamConnection' does not conform to protocol 'WebSocketDelegate'

`

extension CocoaMQTTWebSocket.StarscreamConnection: WebSocketDelegate {

public func didReceive(event: Starscream.WebSocketEvent, client: Starscream.WebSocket) {

    switch event {

    case .connected(let headers):

        delegate?.connectionOpened(self)

        break

    case .disconnected(let reason, let code):

        delegate?.connectionClosed(self, withError: nil, withCode: code)

        break

    case .text(let string):

        delegate?.connection(self, receivedString: string)

        break

    case .binary(let data):

        delegate?.connection(self, receivedData: data)

        break

    case .ping(_):

        break

    case .pong(_):

        break

    case .viabilityChanged(_):

        break

    case .reconnectSuggested(_):

        break

    case .cancelled:

        delegate?.connectionClosed(self, withError: nil, withCode: nil)

        break

    case .error(let error):

        delegate?.connectionClosed(self, withError: error, withCode: nil)

        break

    }

}
}

`

hunganh0403 commented 8 months ago

i have the same issue, which can be worked around by add package with Starscream version 4.0.4

image
leeway1208 commented 8 months ago

4.0.4 Starscream can run demo and build sdk well. 4.0.6 version has some problem. protocol issues