docs/Classes.html
The following classes are available globally.
`
SocketAckEmitter
`
A class that represents a waiting ack call.
NOTE : You should not store this beyond the life of the event handler.
Swift
public final class SocketAckEmitter : NSObject
`
OnAckCallback
`
A class that represents an emit that will request an ack that has not yet been sent. Call timingOut(after:callback:) to complete the emit Example:
socket.emitWithAck("myEvent").timingOut(after: 1) {data in
...
}
Swift
public final class OnAckCallback : NSObject
`
SocketAnyEvent
`
Represents some event that was received.
Swift
public final class SocketAnyEvent : NSObject
`
SocketIOClient
`
Represents a socket.io-client.
Clients are created through a SocketManager, which owns the SocketEngineSpec that controls the connection to the server.
For example:
// Create a socket for the /swift namespace
let socket = manager.socket(forNamespace: "/swift")
// Add some handlers and connect
NOTE : The client is not thread/queue safe, all interaction with the socket should be done on the manager.handleQueue
Swift
open class SocketIOClient : NSObject, SocketIOClientSpec
`
SocketRawView
`
Class that gives a backwards compatible way to cause an emit not to recursively check for Data objects.
Usage:
socket.rawEmitView.emit("myEvent", myObject)
Swift
public final class SocketRawView : NSObject
`
SocketRawAckView
`
Class that gives a backwards compatible way to cause an emit not to recursively check for Data objects.
Usage:
ack.rawEmitView.with(myObject)
Swift
public final class SocketRawAckView : NSObject
`
SocketEngine
`
The class that handles the engine.io protocol and transports. See SocketEnginePollable and SocketEngineWebsocket for transport specific methods.
Swift
open class SocketEngine:
NSObject, WebSocketDelegate, URLSessionDelegate, SocketEnginePollable, SocketEngineWebsocket, ConfigSettable
`
SocketManager
`
A manager for a socket.io connection.
A SocketManager is responsible for multiplexing multiple namespaces through a single SocketEngineSpec.
Example:
let manager = SocketManager(socketURL: URL(string:"http://localhost:8080/")!)
let defaultNamespaceSocket = manager.defaultSocket
let swiftSocket = manager.socket(forNamespace: "/swift")
// defaultNamespaceSocket and swiftSocket both share a single connection to the server
Sockets created through the manager are retained by the manager. So at the very least, a single strong reference to the manager must be maintained to keep sockets alive.
To disconnect a socket and remove it from the manager, either call SocketIOClient.disconnect() on the socket, or call one of the disconnectSocket methods on this class.
NOTE : The manager is not thread/queue safe, all interaction with the manager should be done on the handleQueue
Swift
open class SocketManager : NSObject, SocketManagerSpec, SocketParsable, SocketDataBufferable, ConfigSettable