Classes
The following classes are available globally.
-
The class that handles the engine.io protocol and transports. See
See moreSocketEnginePollable
andSocketEngineWebsocket
for transport specific methods.Declaration
Swift
public final class SocketEngine : NSObject, URLSessionDelegate, SocketEnginePollable, SocketEngineWebsocket, ConfigSettable
-
A class that represents a waiting ack call.
NOTE: You should not store this beyond the life of the event handler.
See moreDeclaration
Swift
public final class SocketAckEmitter : NSObject
-
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:
See moresocket.emitWithAck("myEvent").timingOut(after: 1) {data in ... }
Declaration
Swift
public final class OnAckCallback : NSObject
-
Represents some event that was received.
See moreDeclaration
Swift
public final class SocketAnyEvent : NSObject
-
Represents a socket.io-client.
Clients are created through a
SocketManager
, which owns theSocketEngineSpec
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
See moremanager.handleQueue
Declaration
Swift
open class SocketIOClient : NSObject, SocketIOClientSpec
-
A wrapper around Starscream’s SSLSecurity that provides a minimal Objective-C interface.
See moreDeclaration
Swift
open class SSLSecurity : NSObject
-
A manager for a socket.io connection.
A
SocketManager
is responsible for multiplexing multiple namespaces through a singleSocketEngineSpec
.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
See moreSocketIOClient.disconnect()
on the socket, or call one of thedisconnectSocket
methods on this class.Declaration
Swift
open class SocketManager : NSObject, SocketManagerSpec, SocketParsable, SocketDataBufferable, ConfigSettable