SocketIOClientSpec
public protocol SocketIOClientSpec : AnyObjectDefines the interface for a SocketIOClient.
- 
                  
                  A handler that will be called on any event. DeclarationSwift var anyHandler: ((SocketAnyEvent) -> ())? { get }
- 
                  
                  The array of handlers for this socket. DeclarationSwift var handlers: [SocketEventHandler] { get }
- 
                  
                  The manager for this socket. DeclarationSwift var manager: SocketManagerSpec? { get }
- 
                  
                  The namespace that this socket is currently connected to. Must start with a /.DeclarationSwift var nsp: String { get }
- 
                  
                  A view into this socket where emits do not check for binary data. Usage: socket.rawEmitView.emit("myEvent", myObject)NOTE: It is not safe to hold on to this view beyond the life of the socket. DeclarationSwift var rawEmitView: SocketRawView { get }
- 
                  
                  The id of this socket.io connect. This is different from the sid of the engine.io connection. DeclarationSwift var sid: String? { get }
- 
                  
                  The status of this client. DeclarationSwift var status: SocketIOStatus { get }
- 
                  
                  Connect to the server. The same as calling connect(timeoutAfter:withHandler:)with a timeout of 0.Only call after adding your event listeners, unless you know what you’re doing. DeclarationSwift func connect(withPayload payload: [String : Any]?)ParameterspayloadAn optional payload sent on connect 
- 
                  
                  Connect to the server. If we aren’t connected after timeoutAfterseconds, thenwithHandleris called.Only call after adding your event listeners, unless you know what you’re doing. DeclarationSwift func connect(withPayload payload: [String : Any]?, timeoutAfter: Double, withHandler handler: (() -> ())?)ParameterswithPayloadAn optional payload sent on connect timeoutAfterThe number of seconds after which if we are not connected we assume the connection has failed. Pass 0 to never timeout. handlerThe handler to call when the client fails to connect. 
- 
                  
                  Called when the client connects to a namespace. If the client was created with a namespace upfront, then this is only called when the client connects to that namespace. DeclarationSwift func didConnect(toNamespace namespace: String, payload: [String : Any]?)ParameterstoNamespaceThe namespace that was connected to. 
- 
                  
                  Called when the client has disconnected from socket.io. DeclarationSwift func didDisconnect(reason: String)ParametersreasonThe reason for the disconnection. 
- 
                  didError(reason:Default implementation) Called when the client encounters an error. Default ImplementationDefault implementation. DeclarationSwift func didError(reason: String)ParametersreasonThe reason for the disconnection. 
- 
                  
                  Disconnects the socket. DeclarationSwift func disconnect()
- 
                  
                  Send an event to the server, with optional data items and optional write completion handler. If an error occurs trying to transform itemsinto their socket representation, aSocketClientEvent.errorwill be emitted. The structure of the error data is[eventName, items, theError]DeclarationSwift func emit(_ event: String, _ items: SocketData..., completion: (() -> ())?)ParameterseventThe event to send. itemsThe items to send with this event. May be left out. completionCallback called on transport write completion. 
- 
                  
                  Call when you wish to tell the server that you’ve received the event for ack.DeclarationSwift func emitAck(_ ack: Int, with items: [Any])ParametersackThe ack number. withThe data for this ack. 
- 
                  
                  Sends a message to the server, requesting an ack. NOTE: It is up to the server send an ack back, just calling this method does not mean the server will ack. Check that your server’s api will ack the event being sent. If an error occurs trying to transform itemsinto their socket representation, aSocketClientEvent.errorwill be emitted. The structure of the error data is[eventName, items, theError]Example: socket.emitWithAck("myEvent", 1).timingOut(after: 1) {data in ... }DeclarationSwift func emitWithAck(_ event: String, _ items: SocketData...) -> OnAckCallbackParameterseventThe event to send. itemsThe items to send with this event. May be left out. Return ValueAn OnAckCallback. You must call thetimingOut(after:)method before the event will be sent.
- 
                  
                  Called when socket.io has acked one of our emits. Causes the corresponding ack callback to be called. DeclarationSwift func handleAck(_ ack: Int, data: [Any])ParametersackThe number for this ack. dataThe data sent back with this ack. 
- 
                  
                  Called on socket.io specific events. DeclarationSwift func handleClientEvent(_ event: SocketClientEvent, data: [Any])ParameterseventThe SocketClientEvent.dataThe data for this event. 
- 
                  
                  Called when we get an event from socket.io. DeclarationSwift func handleEvent(_ event: String, data: [Any], isInternalMessage: Bool, withAck ack: Int)ParameterseventThe name of the event. dataThe data that was sent with this event. isInternalMessageWhether this event was sent internally. If trueit is always sent to handlers.ackIf > 0 then this event expects to get an ack back from the client. 
- 
                  
                  Causes a client to handle a socket.io packet. The namespace for the packet must match the namespace of the socket. DeclarationSwift func handlePacket(_ packet: SocketPacket)ParameterspacketThe packet to handle. 
- 
                  
                  Call when you wish to leave a namespace and disconnect this socket. DeclarationSwift func leaveNamespace()
- 
                  
                  Joins nsp. You shouldn’t need to call this directly, instead callconnect.DeclarationSwift func joinNamespace(withPayload payload: [String : Any]?)ParameterswithPayloadThe payload to connect when joining this namespace 
- 
                  
                  Removes handler(s) for a client event. If you wish to remove a client event handler, call the off(id:)with the UUID received from itsoncall.DeclarationSwift func off(clientEvent event: SocketClientEvent)ParametersclientEventThe event to remove handlers for. 
- 
                  
                  Removes handler(s) based on an event name. If you wish to remove a specific event, call the off(id:)with the UUID received from itsoncall.DeclarationSwift func off(_ event: String)ParameterseventThe event to remove handlers for. 
- 
                  
                  Removes a handler with the specified UUID gotten from an onoronceIf you want to remove all events for an event, call the off off(_:)method with the event name.DeclarationSwift func off(id: UUID)ParametersidThe UUID of the handler you wish to remove. 
- 
                  
                  Adds a handler for an event. DeclarationSwift func on(_ event: String, callback: @escaping NormalCallback) -> UUIDParameterseventThe event name for this handler. callbackThe callback that will execute when this event is received. Return ValueA unique id for the handler that can be used to remove it. 
- 
                  
                  Adds a handler for a client event. Example: socket.on(clientEvent: .connect) {data, ack in ... }DeclarationSwift func on(clientEvent event: SocketClientEvent, callback: @escaping NormalCallback) -> UUIDParameterseventThe event for this handler. callbackThe callback that will execute when this event is received. Return ValueA unique id for the handler that can be used to remove it. 
- 
                  
                  Adds a single-use handler for a client event. DeclarationSwift func once(clientEvent event: SocketClientEvent, callback: @escaping NormalCallback) -> UUIDParametersclientEventThe event for this handler. callbackThe callback that will execute when this event is received. Return ValueA unique id for the handler that can be used to remove it. 
- 
                  
                  Adds a single-use handler for an event. DeclarationSwift func once(_ event: String, callback: @escaping NormalCallback) -> UUIDParameterseventThe event name for this handler. callbackThe callback that will execute when this event is received. Return ValueA unique id for the handler that can be used to remove it. 
- 
                  
                  Adds a handler that will be called on every event. DeclarationSwift func onAny(_ handler: @escaping (SocketAnyEvent) -> ())ParametershandlerThe callback that will execute whenever an event is received. 
- 
                  
                  Removes all handlers. Can be used after disconnecting to break any potential remaining retain cycles. DeclarationSwift func removeAllHandlers()
- 
                  
                  Puts the socket back into the connecting state. Called when the manager detects a broken connection, or when a manual reconnect is triggered. parameter reason: The reason this socket is going reconnecting. DeclarationSwift func setReconnecting(reason: String)
 SocketIOClientSpec Protocol Reference
      SocketIOClientSpec Protocol Reference