Fix build
This commit is contained in:
parent
a4b334b6f2
commit
8f94c038d8
@ -230,7 +230,7 @@ open class SocketIOClient : NSObject, SocketIOClientSpec {
|
|||||||
/// - parameter event: The event to send.
|
/// - parameter event: The event to send.
|
||||||
/// - parameter items: The items to send with this event. May be left out.
|
/// - parameter items: The items to send with this event. May be left out.
|
||||||
/// - parameter completion: Callback called on transport write completion.
|
/// - parameter completion: Callback called on transport write completion.
|
||||||
open func emit(_ event: String, _ items: SocketData..., completion: @escaping (() -> ())? = nil) {
|
open func emit(_ event: String, _ items: SocketData..., completion: (() -> ())? = nil) {
|
||||||
do {
|
do {
|
||||||
try emit(event, with: items.map({ try $0.socketRepresentation() }), completion: completion)
|
try emit(event, with: items.map({ try $0.socketRepresentation() }), completion: completion)
|
||||||
} catch {
|
} catch {
|
||||||
@ -256,7 +256,7 @@ open class SocketIOClient : NSObject, SocketIOClientSpec {
|
|||||||
/// - parameter items: The items to send with this event. Send an empty array to send no data.
|
/// - parameter items: The items to send with this event. Send an empty array to send no data.
|
||||||
/// - parameter completion: Callback called on transport write completion.
|
/// - parameter completion: Callback called on transport write completion.
|
||||||
@objc
|
@objc
|
||||||
open func emit(_ event: String, with items: [Any], completion: @escaping (() -> ())? = nil) {
|
open func emit(_ event: String, with items: [Any], completion: (() -> ())? = nil) {
|
||||||
emit([event] + items, completion: completion)
|
emit([event] + items, completion: completion)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -317,13 +317,13 @@ open class SocketIOClient : NSObject, SocketIOClientSpec {
|
|||||||
ack: Int? = nil,
|
ack: Int? = nil,
|
||||||
binary: Bool = true,
|
binary: Bool = true,
|
||||||
isAck: Bool = false,
|
isAck: Bool = false,
|
||||||
completion: @escaping (() -> ())? = nil
|
completion: (() -> ())? = nil
|
||||||
) {
|
) {
|
||||||
// wrap the completion handler so it always runs async via handlerQueue
|
// wrap the completion handler so it always runs async via handlerQueue
|
||||||
let wrappedCompletion: (() -> ())? = (completion == nil) ? nil : {[weak self] in
|
let wrappedCompletion: (() -> ())? = (completion == nil) ? nil : {[weak self] in
|
||||||
guard let this = self else { return }
|
guard let this = self else { return }
|
||||||
this.manager?.handleQueue.async {
|
this.manager?.handleQueue.async {
|
||||||
completion()
|
completion!()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -109,7 +109,7 @@ public protocol SocketIOClientSpec : AnyObject {
|
|||||||
/// - parameter event: The event to send.
|
/// - parameter event: The event to send.
|
||||||
/// - parameter items: The items to send with this event. May be left out.
|
/// - parameter items: The items to send with this event. May be left out.
|
||||||
/// - parameter completion: Callback called on transport write completion.
|
/// - parameter completion: Callback called on transport write completion.
|
||||||
func emit(_ event: String, _ items: SocketData..., completion: @escaping (() -> ())? = nil)
|
func emit(_ event: String, _ items: SocketData..., completion: (() -> ())?)
|
||||||
|
|
||||||
/// Call when you wish to tell the server that you've received the event for `ack`.
|
/// Call when you wish to tell the server that you've received the event for `ack`.
|
||||||
///
|
///
|
||||||
|
|||||||
@ -617,7 +617,7 @@ open class SocketEngine : NSObject, URLSessionDelegate, SocketEnginePollable, So
|
|||||||
/// - parameter type: The type of this message.
|
/// - parameter type: The type of this message.
|
||||||
/// - parameter data: Any data that this message has.
|
/// - parameter data: Any data that this message has.
|
||||||
/// - parameter completion: Callback called on transport write completion.
|
/// - parameter completion: Callback called on transport write completion.
|
||||||
open func write(_ msg: String, withType type: SocketEnginePacketType, withData data: [Data], completion: @escaping (() -> ())? = nil) {
|
open func write(_ msg: String, withType type: SocketEnginePacketType, withData data: [Data], completion: (() -> ())? = nil) {
|
||||||
engineQueue.async {
|
engineQueue.async {
|
||||||
guard self.connected else {
|
guard self.connected else {
|
||||||
completion?()
|
completion?()
|
||||||
|
|||||||
@ -65,7 +65,7 @@ public protocol SocketEnginePollable : SocketEngineSpec {
|
|||||||
/// - parameter message: The message to send.
|
/// - parameter message: The message to send.
|
||||||
/// - parameter withType: The type of message to send.
|
/// - parameter withType: The type of message to send.
|
||||||
/// - parameter withData: The data associated with this message.
|
/// - parameter withData: The data associated with this message.
|
||||||
func sendPollMessage(_ message: String, withType type: SocketEnginePacketType, withData datas: [Data], completion: @escaping (() -> ())?)
|
func sendPollMessage(_ message: String, withType type: SocketEnginePacketType, withData datas: [Data], completion: (() -> ())?)
|
||||||
|
|
||||||
/// Call to stop polling and invalidate the URLSession.
|
/// Call to stop polling and invalidate the URLSession.
|
||||||
func stopPolling()
|
func stopPolling()
|
||||||
@ -219,7 +219,7 @@ extension SocketEnginePollable {
|
|||||||
/// - parameter withType: The type of message to send.
|
/// - parameter withType: The type of message to send.
|
||||||
/// - parameter withData: The data associated with this message.
|
/// - parameter withData: The data associated with this message.
|
||||||
/// - parameter completion: Callback called on transport write completion.
|
/// - parameter completion: Callback called on transport write completion.
|
||||||
public func sendPollMessage(_ message: String, withType type: SocketEnginePacketType, withData datas: [Data], completion: @escaping (() -> ())? = nil) {
|
public func sendPollMessage(_ message: String, withType type: SocketEnginePacketType, withData datas: [Data], completion: (() -> ())? = nil) {
|
||||||
DefaultSocketLogger.Logger.log("Sending poll: \(message) as type: \(type.rawValue)", type: "SocketEnginePolling")
|
DefaultSocketLogger.Logger.log("Sending poll: \(message) as type: \(type.rawValue)", type: "SocketEnginePolling")
|
||||||
|
|
||||||
postWait.append((String(type.rawValue) + message, completion))
|
postWait.append((String(type.rawValue) + message, completion))
|
||||||
|
|||||||
@ -138,7 +138,7 @@ import Starscream
|
|||||||
/// - parameter type: The type of this message.
|
/// - parameter type: The type of this message.
|
||||||
/// - parameter data: Any data that this message has.
|
/// - parameter data: Any data that this message has.
|
||||||
/// - parameter completion: Callback called on transport write completion.
|
/// - parameter completion: Callback called on transport write completion.
|
||||||
func write(_ msg: String, withType type: SocketEnginePacketType, withData data: [Data], completion: @escaping (() -> ())?)
|
func write(_ msg: String, withType type: SocketEnginePacketType, withData data: [Data], completion: (() -> ())?)
|
||||||
}
|
}
|
||||||
|
|
||||||
extension SocketEngineSpec {
|
extension SocketEngineSpec {
|
||||||
@ -180,7 +180,7 @@ extension SocketEngineSpec {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// Send an engine message (4)
|
/// Send an engine message (4)
|
||||||
func send(_ msg: String, withData datas: [Data], completion: @escaping (() -> ())? = nil) {
|
func send(_ msg: String, withData datas: [Data], completion: (() -> ())? = nil) {
|
||||||
write(msg, withType: .message, withData: datas, completion: completion)
|
write(msg, withType: .message, withData: datas, completion: completion)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -41,7 +41,7 @@ public protocol SocketEngineWebsocket : SocketEngineSpec {
|
|||||||
func sendWebSocketMessage(_ str: String,
|
func sendWebSocketMessage(_ str: String,
|
||||||
withType type: SocketEnginePacketType,
|
withType type: SocketEnginePacketType,
|
||||||
withData datas: [Data],
|
withData datas: [Data],
|
||||||
completion: @escaping (() -> ())?)
|
completion: (() -> ())?)
|
||||||
}
|
}
|
||||||
|
|
||||||
// WebSocket methods
|
// WebSocket methods
|
||||||
@ -63,7 +63,7 @@ extension SocketEngineWebsocket {
|
|||||||
public func sendWebSocketMessage(_ str: String,
|
public func sendWebSocketMessage(_ str: String,
|
||||||
withType type: SocketEnginePacketType,
|
withType type: SocketEnginePacketType,
|
||||||
withData datas: [Data],
|
withData datas: [Data],
|
||||||
completion: @escaping (() -> ())?
|
completion: (() -> ())?
|
||||||
) {
|
) {
|
||||||
DefaultSocketLogger.Logger.log("Sending ws: \(str) as type: \(type.rawValue)", type: "SocketEngineWebSocket")
|
DefaultSocketLogger.Logger.log("Sending ws: \(str) as type: \(type.rawValue)", type: "SocketEngineWebSocket")
|
||||||
|
|
||||||
|
|||||||
@ -198,7 +198,7 @@ public class TestSocket : SocketIOClient {
|
|||||||
super.didDisconnect(reason: reason)
|
super.didDisconnect(reason: reason)
|
||||||
}
|
}
|
||||||
|
|
||||||
public override func emit(_ event: String, with items: [Any], completion: @escaping (() -> ())?) {
|
public override func emit(_ event: String, with items: [Any], completion: (() -> ())?) {
|
||||||
expectations[ManagerExpectation.emitAllEventCalled]?.fulfill()
|
expectations[ManagerExpectation.emitAllEventCalled]?.fulfill()
|
||||||
expectations[ManagerExpectation.emitAllEventCalled] = nil
|
expectations[ManagerExpectation.emitAllEventCalled] = nil
|
||||||
|
|
||||||
|
|||||||
@ -511,5 +511,5 @@ class TestEngine : SocketEngineSpec {
|
|||||||
func flushWaitingForPostToWebSocket() { }
|
func flushWaitingForPostToWebSocket() { }
|
||||||
func parseEngineData(_ data: Data) { }
|
func parseEngineData(_ data: Data) { }
|
||||||
func parseEngineMessage(_ message: String) { }
|
func parseEngineMessage(_ message: String) { }
|
||||||
func write(_ msg: String, withType type: SocketEnginePacketType, withData data: [Data], completion: @escaping (() -> ())?) { }
|
func write(_ msg: String, withType type: SocketEnginePacketType, withData data: [Data], completion: (() -> ())?) { }
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user