document SocketPacket.PacketType
This commit is contained in:
parent
43907a4001
commit
665cfef8d3
@ -27,13 +27,6 @@ import Foundation
|
|||||||
|
|
||||||
/// A struct that represents a socket.io packet.
|
/// A struct that represents a socket.io packet.
|
||||||
public struct SocketPacket : CustomStringConvertible {
|
public struct SocketPacket : CustomStringConvertible {
|
||||||
// MARK: PacketType enum
|
|
||||||
|
|
||||||
/// The type of packets.
|
|
||||||
public enum PacketType: Int {
|
|
||||||
case connect, disconnect, event, ack, error, binaryEvent, binaryAck
|
|
||||||
}
|
|
||||||
|
|
||||||
// MARK: Properties
|
// MARK: Properties
|
||||||
|
|
||||||
private static let logType = "SocketPacket"
|
private static let logType = "SocketPacket"
|
||||||
@ -165,6 +158,36 @@ public struct SocketPacket : CustomStringConvertible {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public extension SocketPacket {
|
||||||
|
// MARK: PacketType enum
|
||||||
|
|
||||||
|
/// The type of packets.
|
||||||
|
public enum PacketType: Int {
|
||||||
|
// MARK: Cases
|
||||||
|
|
||||||
|
/// Connect: 0
|
||||||
|
case connect
|
||||||
|
|
||||||
|
/// Disconnect: 1
|
||||||
|
case disconnect
|
||||||
|
|
||||||
|
/// Event: 2
|
||||||
|
case event
|
||||||
|
|
||||||
|
/// Ack: 3
|
||||||
|
case ack
|
||||||
|
|
||||||
|
/// Error: 4
|
||||||
|
case error
|
||||||
|
|
||||||
|
/// Binary Event: 5
|
||||||
|
case binaryEvent
|
||||||
|
|
||||||
|
/// Binary Ack: 6
|
||||||
|
case binaryAck
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
extension SocketPacket {
|
extension SocketPacket {
|
||||||
private static func findType(_ binCount: Int, ack: Bool) -> PacketType {
|
private static func findType(_ binCount: Int, ack: Bool) -> PacketType {
|
||||||
switch binCount {
|
switch binCount {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user