Classes
The following classes are available globally.
-
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
-
Class that gives a backwards compatible way to cause an emit not to recursively check for Data objects.
Usage:
See moresocket.rawEmitView.emit("myEvent", myObject)
Declaration
Swift
public final class SocketRawView : NSObject
-
Class that gives a backwards compatible way to cause an emit not to recursively check for Data objects.
Usage:
See moreack.rawEmitView.with(myObject)
Declaration
Swift
public final class SocketRawAckView : NSObject
-
The class that handles the engine.io protocol and transports. See
See moreSocketEnginePollable
andSocketEngineWebsocket
for transport specific methods.Declaration
Swift
open class SocketEngine: NSObject, WebSocketDelegate, URLSessionDelegate, SocketEnginePollable, SocketEngineWebsocket, ConfigSettable
-
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
SocketIOClient.disconnect()
on the socket, or call one of thedisconnectSocket
methods on this class.NOTE: The manager is not thread/queue safe, all interaction with the manager should be done on the
See morehandleQueue
Declaration
Swift
open class SocketManager : NSObject, SocketManagerSpec, SocketParsable, SocketDataBufferable, ConfigSettable