More linux work
This commit is contained in:
		
							parent
							
								
									95b3bfc802
								
							
						
					
					
						commit
						e0d8f16666
					
				@ -105,10 +105,8 @@ public final class SocketEngine : NSObject, URLSessionDelegate, SocketEnginePoll
 | 
			
		||||
    /// Whether or not this engine uses secure transports
 | 
			
		||||
    public private(set) var secure = false
 | 
			
		||||
 | 
			
		||||
    #if !os(Linux)
 | 
			
		||||
    /// A custom security validator for Starscream. Useful for SSL pinning.
 | 
			
		||||
    public private(set) var security: SSLSecurity?
 | 
			
		||||
    #endif
 | 
			
		||||
 | 
			
		||||
    /// Whether or not to allow self signed certificates.
 | 
			
		||||
    public private(set) var selfSigned = false
 | 
			
		||||
 | 
			
		||||
@ -145,9 +145,9 @@ extension SocketEngineWebsocket {
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    #if !os(Linux)
 | 
			
		||||
    // MARK: Starscream delegate methods
 | 
			
		||||
 | 
			
		||||
    #if !os(Linux)
 | 
			
		||||
    /// Delegate method for when a message is received.
 | 
			
		||||
    public func websocketDidReceiveMessage(socket: WebSocket, text: String) {
 | 
			
		||||
        parseEngineMessage(text)
 | 
			
		||||
@ -168,5 +168,23 @@ extension WebSocket {
 | 
			
		||||
    var isConnected: Bool {
 | 
			
		||||
        return state == .open
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    func write(string: String) {
 | 
			
		||||
        do {
 | 
			
		||||
            try ws?.send(string)
 | 
			
		||||
        } catch {
 | 
			
		||||
            DefaultSocketLogger.Logger.error("Error sending string", type: "SocketEngineWebsocket", args: string)
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    func write(data: Data) {
 | 
			
		||||
        do {
 | 
			
		||||
            try data.withUnsafeBytes {(bytes: UnsafePointer<UInt8>) in
 | 
			
		||||
                try ws?.send(Array(UnsafeBufferPointer(start: bytes, count: data.count)))
 | 
			
		||||
            }
 | 
			
		||||
        } catch {
 | 
			
		||||
            DefaultSocketLogger.Logger.error("Error sending data", type: "SocketEngineWebsocket", args: data)
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
@ -23,7 +23,9 @@
 | 
			
		||||
//  THE SOFTWARE.
 | 
			
		||||
 | 
			
		||||
import Foundation
 | 
			
		||||
#if !os(Linux)
 | 
			
		||||
import StarscreamSocketIO
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
enum JSONError : Error {
 | 
			
		||||
    case notArray
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user