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 more

    Declaration

    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:

    socket.emitWithAck("myEvent").timingOut(after: 1) {data in
        ...
    }
    
    See more

    Declaration

    Swift

    public final class OnAckCallback : NSObject
  • Represents some event that was received.

    See more

    Declaration

    Swift

    public final class SocketAnyEvent : NSObject
  • 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

    See more

    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:

    socket.rawEmitView.emit("myEvent", myObject)
    
    See more

    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:

    ack.rawEmitView.with(myObject)
    
    See more

    Declaration

    Swift

    public final class SocketRawAckView : NSObject
  • The class that handles the engine.io protocol and transports. See SocketEnginePollable and SocketEngineWebsocket for transport specific methods.

    See more

    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 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

    See more

    Declaration

    Swift

    open class SocketManager : NSObject, SocketManagerSpec, SocketParsable, SocketDataBufferable, ConfigSettable