@@ -30,7 +30,7 @@ extension String {
30
30
}
31
31
}
32
32
33
- private typealias Probe = ( msg: String , type: PacketType , data: [ NSData ] ? )
33
+ private typealias Probe = ( msg: String , type: PacketType , data: ContiguousArray < NSData > ? )
34
34
private typealias ProbeWaitQueue = [ Probe ]
35
35
36
36
public enum PacketType : String {
@@ -477,7 +477,7 @@ public class SocketEngine: NSObject, WebSocketDelegate {
477
477
}
478
478
479
479
/// Send an engine message (4)
480
- public func send( msg: String , withData datas: [ NSData ] ? ) {
480
+ public func send( msg: String , withData datas: ContiguousArray < NSData > ? ) {
481
481
if self . probing {
482
482
self . probeWait. append ( ( msg, PacketType . MESSAGE, datas) )
483
483
} else {
@@ -494,9 +494,8 @@ public class SocketEngine: NSObject, WebSocketDelegate {
494
494
}
495
495
496
496
private func sendPollMessage( var msg: String , withType type: PacketType ,
497
- datas: [ NSData ] ? = nil ) {
497
+ datas: ContiguousArray < NSData > ? = nil ) {
498
498
// println("Sending poll: \(msg) as type: \(type.rawValue)")
499
-
500
499
doubleEncodeUTF8 ( & msg)
501
500
let strMsg = " \( type. rawValue) \( msg) "
502
501
@@ -515,18 +514,19 @@ public class SocketEngine: NSObject, WebSocketDelegate {
515
514
}
516
515
}
517
516
518
- private func sendWebSocketMessage( str: String , withType type: PacketType , datas: [ NSData ] ? = nil ) {
519
- // println("Sending ws: \(str) as type: \(type.rawValue)")
520
- self . ws? . writeString ( " \( type. rawValue) \( str) " )
521
-
522
- if datas != nil {
523
- for data in datas! {
524
- let ( data, nilString) = self . createBinaryDataForSend ( data)
525
- if data != nil {
526
- self . ws? . writeData ( data!)
517
+ private func sendWebSocketMessage( str: String , withType type: PacketType ,
518
+ datas: ContiguousArray < NSData > ? = nil ) {
519
+ // println("Sending ws: \(str) as type: \(type.rawValue)")
520
+ self . ws? . writeString ( " \( type. rawValue) \( str) " )
521
+
522
+ if datas != nil {
523
+ for data in datas! {
524
+ let ( data, nilString) = self . createBinaryDataForSend ( data)
525
+ if data != nil {
526
+ self . ws? . writeData ( data!)
527
+ }
527
528
}
528
529
}
529
- }
530
530
}
531
531
532
532
// Starts the ping timer
@@ -552,7 +552,7 @@ public class SocketEngine: NSObject, WebSocketDelegate {
552
552
}
553
553
}
554
554
555
- public func write( msg: String , withType type: PacketType , withData data: [ NSData ] ? ) {
555
+ public func write( msg: String , withType type: PacketType , withData data: ContiguousArray < NSData > ? ) {
556
556
dispatch_async ( self . emitQueue) { [ weak self] in
557
557
if self == nil {
558
558
return
0 commit comments