SocketIO
Socket.io client.
-
Creates a SocketIO instance providing the URL string of the server.
Declaration
Swift
convenience public init(url: String)Parameters
urlURL that will be used to establish the transport connection.
-
Creates a SocketIO instance with Options.
Declaration
Swift
convenience public init(url: String, withOptions options: SocketIOOptions)Parameters
urlURL that will be used to establish the transport connection.
optionsCustom options.
let options = SocketIOOptions().namespace(
/users
) -
Creates a SocketIO instance providing the NSURL of the server.
Declaration
Swift
convenience public init(nsurl: NSURL)Parameters
nsurlURL that will be used to establish the transport connection.
-
Creates a SocketIO instance with Options.
Declaration
Swift
convenience public init(nsurl: NSURL, withOptions options: SocketIOOptions)Parameters
nsurlURL that will be used to establish the transport connection.
optionsCustom options.
let options = SocketIOOptions().namespace(
/users
) -
Creates a SocketIO instance with Options.
Declaration
Swift
public init(nsurl: NSURL, withOptions options: SocketIOOptions, withRequest request: SocketIORequester, withTransport transport: SocketIOTransport.Type)Parameters
nsurlURL that will be used to establish the transport connection.
optionsCustom options.
requestCustom request.
transportCustom transport.
let options = SocketIOOptions().namespace(
/users
) -
Connects to the Socket.io server.
Declaration
Swift
public final func connect() -
Disconnects the current connection.
Declaration
Swift
public final func disconnect() -
Reconnects to the Socket.io server. It closes the current connection and establishes a new one.
Declaration
Swift
public final func reconnect()
-
Sends a text message to the server.
Declaration
Swift
public final func emit(event: SocketIOEvent, withMessage message: String)Parameters
eventEvent name provided with SocketIOEvent.
messageMessage to send.
-
Sends a text message to the server.
Declaration
Swift
public final func emit(event: T, withMessage message: String)Parameters
eventEvent name provided with generic type.
messageMessage to send.
-
Sends a text message to the server.
Declaration
Swift
public final func emit(event: String, withMessage message: String)Parameters
eventEvent name.
messageMessage to send.
-
Sends a list of items to the server.
Declaration
Swift
public final func emit(event: SocketIOEvent, withList list: NSArray)Parameters
eventEvent name provided with SocketIOEvent.
listList of type NSArray to send.
-
Sends a list of items to the server.
Declaration
Swift
public final func emit(event: T, withList list: NSArray)Parameters
eventEvent name provided with generic type.
listList of type NSArray to send.
-
Sends a list of items to the server.
Declaration
Swift
public final func emit(event: String, withList list: NSArray)Parameters
eventEvent name.
listList of type NSArray to send.
-
Sends a dictionary (key-value) to the server.
Declaration
Swift
public final func emit(event: SocketIOEvent, withDictionary dict: NSDictionary)Parameters
eventEvent name provided with SocketIOEvent.
dictKey-value object of type NSDictionary to send.
-
Sends a dictionary (key-value) to the server.
Declaration
Swift
public final func emit(event: T, withDictionary dict: NSDictionary)Parameters
eventEvent name provided with generic type.
dictKey-value object of type NSDictionary to send.
-
Sends a dictionary (key-value) to the server.
Declaration
Swift
public final func emit(event: String, withDictionary dict: NSDictionary)Parameters
eventEvent name.
dictKey-value object of type NSDictionary to send.
-
Sends a object to the server.
Declaration
Swift
public final func emit(event: SocketIOEvent, withObject object: SocketIOObject)Parameters
eventEvent name provided with SocketIOEvent.
objectObject that comply SocketIOObject protocol.
-
Sends a object to the server.
Declaration
Swift
public final func emit(event: T, withObject object: SocketIOObject)Parameters
eventEvent name provided with generic type.
objectObject that comply SocketIOObject protocol.
-
Sends a object to the server.
Declaration
Swift
public final func emit(event: String, withObject object: SocketIOObject)Parameters
eventEvent name provided.
objectObject that comply SocketIOObject protocol.
-
Callback fired upon a successful event call.
Declaration
Swift
public final func on(event: SocketIOEvent, withCallback callback: SocketIOCallback) -> SocketIOEventHandlerParameters
eventEvent name provided with SocketIOEvent.
callbackFunction of type SocketIOCallback.
-
Callback fired upon a successful event call.
Declaration
Swift
public final func on(event: T, withCallback callback: SocketIOCallback) -> SocketIOEventHandlerParameters
eventEvent name provided with generic type.
callbackFunction of type SocketIOCallback.
-
Callback fired upon a successful event call.
Declaration
Swift
public final func on(event: String, withCallback callback: SocketIOCallback) -> SocketIOEventHandlerParameters
eventEvent name provided.
callbackFunction of type SocketIOCallback.
-
Callback fired upon any event is called.
Declaration
Swift
public final func onAny(callback: SocketIOCallback) -> SocketIOEventHandlerParameters
callbackFunction of type SocketIOCallback.
-
Remove all callbacks for events.
Declaration
Swift
public final func off() -> SocketIOEventHandler
View on GitHub
SocketIO Class Reference