docs/Protocols.html
The following protocols are available globally.
`
ConfigSettable
`
Declares that a type can set configs from a SocketIOClientConfiguration.
Swift
public protocol ConfigSettable
`
SocketIOClientSpec
`
Defines the interface for a SocketIOClient.
Swift
public protocol SocketIOClientSpec : AnyObject
`
SocketEngineClient
`
Declares that a type will be a delegate to an engine.
Swift
@objc
public protocol SocketEngineClient
`
SocketEnginePollable
`
Protocol that is used to implement socket.io polling support
Swift
public protocol SocketEnginePollable : SocketEngineSpec
`
SocketEngineSpec
`
Specifies a SocketEngine.
Swift
public protocol SocketEngineSpec : AnyObject
`
SocketEngineWebsocket
`
Protocol that is used to implement socket.io WebSocket support
Swift
public protocol SocketEngineWebsocket : SocketEngineSpec
`
SocketManagerSpec
`
A manager for a socket.io connection.
A SocketManagerSpec is responsible for multiplexing multiple namespaces through a single SocketEngineSpec.
Example with SocketManager:
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.
Swift
public protocol SocketManagerSpec : AnyObject, SocketEngineClient
`
SocketParsable
`
Defines that a type will be able to parse socket.io-protocol messages.
Swift
public protocol SocketParsable : AnyObject
`
SocketDataBufferable
`
Says that a type will be able to buffer binary data before all data for an event has come in.
Swift
public protocol SocketDataBufferable : AnyObject
`
SocketLogger
`
Represents a class will log client events.
Swift
public protocol SocketLogger : AnyObject
`
SocketData
`
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))
Swift
public protocol SocketData