0001    // CloseCode.swift
0002    //
0003    // The MIT License (MIT)
0004    //
0005    // Copyright (c) 2015 Zewo
0006    //
0007    // Permission is hereby granted, free of charge, to any person obtaining a copy
0008    // of this software and associated documentation files (the "Software"), to deal
0009    // in the Software without restriction, including without limitation the rights
0010    // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
0011    // copies of the Software, and to permit persons to whom the Software is
0012    // furnished to do so, subject to the following conditions:
0013    //
0014    // The above copyright notice and this permission notice shall be included in all
0015    // copies or substantial portions of the Software.
0016    //
0017    // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
0018    // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
0019    // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
0020    // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
0021    // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
0022    // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
0023    // SOFTWARE.
0024    
0025    public enum CloseCode
CloseCode.swift:44
		case 1000: self = Normal
CloseCode.swift:45
		case 1001: self = GoingAway
CloseCode.swift:46
		case 1002: self = ProtocolError
CloseCode.swift:47
		case 1003: self = Unsupported
CloseCode.swift:48
		case 1005: self = NoStatus
CloseCode.swift:49
		case 1006: self = Abnormal
CloseCode.swift:50
		case 1007: self = UnsupportedData
CloseCode.swift:51
		case 1008: self = PolicyViolation
CloseCode.swift:52
		case 1009: self = TooLarge
CloseCode.swift:53
		case 1010: self = MissingExtension
CloseCode.swift:54
		case 1011: self = InternalError
CloseCode.swift:55
		case 1012: self = ServiceRestart
CloseCode.swift:56
		case 1013: self = TryAgainLater
CloseCode.swift:57
		case 1015: self = TLSHandshake
Socket.swift:109
    private let closeEventEmitter = EventEmitter<(code: CloseCode?, reason: String?)>()
Socket.swift:150
    public func close(code: CloseCode = .Normal, reason: String? = nil) throws {
Socket.swift:442
				let closeCode: CloseCode?
Socket.swift:444
					closeCode = CloseCode(code: rawCloseCode)
{ 0026 case Normal
CloseCode.swift:44
		case 1000: self = Normal
CloseCode.swift:64
		case .Normal:			return 1000
Socket.swift:150
    public func close(code: CloseCode = .Normal, reason: String? = nil) throws {
Socket.swift:449
				try close(closeCode ?? .Normal, reason: closeReason)
0027 case GoingAway
CloseCode.swift:45
		case 1001: self = GoingAway
CloseCode.swift:65
		case .GoingAway:		return 1001
0028 case ProtocolError
CloseCode.swift:46
		case 1002: self = ProtocolError
CloseCode.swift:66
		case .ProtocolError:	return 1002
Socket.swift:227
			try close(.ProtocolError)
0029 case Unsupported
CloseCode.swift:47
		case 1003: self = Unsupported
CloseCode.swift:67
		case .Unsupported:		return 1003
0030 case NoStatus
CloseCode.swift:48
		case 1005: self = NoStatus
CloseCode.swift:68
		case .NoStatus:			return 1005
0031 case Abnormal
CloseCode.swift:49
		case 1006: self = Abnormal
CloseCode.swift:69
		case .Abnormal:			return 1006
0032 case UnsupportedData
CloseCode.swift:50
		case 1007: self = UnsupportedData
CloseCode.swift:70
		case .UnsupportedData:	return 1007
0033 case PolicyViolation
CloseCode.swift:51
		case 1008: self = PolicyViolation
CloseCode.swift:71
		case .PolicyViolation:	return 1008
0034 case TooLarge
CloseCode.swift:52
		case 1009: self = TooLarge
CloseCode.swift:72
		case .TooLarge:			return 1009
0035 case MissingExtension
CloseCode.swift:53
		case 1010: self = MissingExtension
CloseCode.swift:73
		case .MissingExtension:	return 1010
0036 case InternalError
CloseCode.swift:54
		case 1011: self = InternalError
CloseCode.swift:74
		case .InternalError:	return 1011
0037 case ServiceRestart
CloseCode.swift:55
		case 1012: self = ServiceRestart
CloseCode.swift:75
		case .ServiceRestart:	return 1012
0038 case TryAgainLater
CloseCode.swift:56
		case 1013: self = TryAgainLater
CloseCode.swift:76
		case .TryAgainLater:	return 1013
0039 case TLSHandshake
CloseCode.swift:57
		case 1015: self = TLSHandshake
CloseCode.swift:77
		case .TLSHandshake:		return 1015
0040 case Raw
CloseCode.swift:58
		default:   self = .Raw(UInt16(code))
CloseCode.swift:78
		case .Raw(let code):	return code
(UInt16) 0041 0042 init
Socket.swift:444
					closeCode = CloseCode(code: rawCloseCode)
(code: Int) { 0043 switch code { 0044 case 1000: self = Normal 0045 case 1001: self = GoingAway 0046 case 1002: self = ProtocolError 0047 case 1003: self = Unsupported 0048 case 1005: self = NoStatus 0049 case 1006: self = Abnormal 0050 case 1007: self = UnsupportedData 0051 case 1008: self = PolicyViolation 0052 case 1009: self = TooLarge 0053 case 1010: self = MissingExtension 0054 case 1011: self = InternalError 0055 case 1012: self = ServiceRestart 0056 case 1013: self = TryAgainLater 0057 case 1015: self = TLSHandshake 0058 default: self = .Raw(UInt16(code)) 0059 } 0060 } 0061 0062 var code: UInt16 { 0063 switch self { 0064 case .Normal: return 1000 0065 case .GoingAway: return 1001 0066 case .ProtocolError: return 1002 0067 case .Unsupported: return 1003 0068 case .NoStatus: return 1005 0069 case .Abnormal: return 1006 0070 case .UnsupportedData: return 1007 0071 case .PolicyViolation: return 1008 0072 case .TooLarge: return 1009 0073 case .MissingExtension: return 1010 0074 case .InternalError: return 1011 0075 case .ServiceRestart: return 1012 0076 case .TryAgainLater: return 1013 0077 case .TLSHandshake: return 1015 0078 case .Raw(let code): return code 0079 } 0080 } 0081 } 0082