document connect data item

This commit is contained in:
Erik 2017-07-04 08:46:07 -04:00
parent 141b0ce6bc
commit beaa4b695c
No known key found for this signature in database
GPG Key ID: 4930B7C5FBC1A69D

View File

@ -48,7 +48,15 @@ extension SocketIOClientSpec {
/// The set of events that are generated by the client. /// The set of events that are generated by the client.
public enum SocketClientEvent : String { public enum SocketClientEvent : String {
/// Emitted when the client connects. This is also called on a successful reconnection. /// Emitted when the client connects. This is also called on a successful reconnection. A connect event gets one
/// data item: the namespace that was connected to.
///
/// ```swift
/// socket.on(clientEvent: .connect) {data, ack in
/// guard let nsp = data[0] as? String else { return }
/// // Some logic using the nsp
/// }
/// ```
case connect case connect
/// Called when the socket has disconnected and will not attempt to try to reconnect. /// Called when the socket has disconnected and will not attempt to try to reconnect.