socket.io-client-swift icon indicating copy to clipboard operation
socket.io-client-swift copied to clipboard

websocket 重连错误, guard !status.active else 第一次之后,永远return

Open kou8910 opened this issue 3 years ago • 1 comments

SocketManager.swift

open func connect() { guard !status.active else { DefaultSocketLogger.Logger.log("Tried connecting an already active socket", type: SocketManager.logType)

        return
    }

    if engine == nil || forceNew {
        addEngine()
    }

    status = .connecting

    engine?.connect()
}

public var active: Bool { return self == .connected || self == .connecting }

第二次重连就不会在进入 engine?.connect(), !status.active 永远为true ,永远return Tried connecting an already active socket

需要修改为 public var active: Bool { return self == .connected }

kou8910 avatar Feb 24 '22 03:02 kou8910

别用这个 socket.io-client-swift 了,作者不用心,也不维护了。 Socket.io 作为 server 不错,但在 iOS 上并没有稳定可靠的 client SDK.

ldbfrank avatar Mar 24 '22 13:03 ldbfrank