Protocols

The following protocols are available globally.

  • Declares that a type will be a delegate to an engine.

    See more

    Declaration

    Swift

    @objc public protocol SocketEngineClient
  • Defines the interface for a SocketIOClient.

    See more

    Declaration

    Swift

    public protocol SocketIOClientSpec : class
  • A marking protocol that says a type can be represented in a socket.io packet.

    Example:

    struct CustomData : SocketData {
       let name: String
       let age: Int
    
       func socketRepresentation() -> SocketData {
           return ["name": name, "age": age]
       }
    }
    
    socket.emit("myEvent", CustomData(name: "Erik", age: 24))
    
    See more

    Declaration

    Swift

    public protocol SocketData
  • Represents a class will log client events.

    See more

    Declaration

    Swift

    public protocol SocketLogger : class
  • Defines that a type will be able to parse socket.io-protocol messages.

    See more

    Declaration

    Swift

    public protocol SocketParsable : class