SocketIO
Socket.io client.
-
Creates a SocketIO instance providing the URL string of the server.
Declaration
Swift
convenience public init(url: String)
Parameters
url
URL 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
url
URL that will be used to establish the transport connection.
options
Custom options.
let options = SocketIOOptions().namespace(
/users
) -
Creates a SocketIO instance providing the NSURL of the server.
Declaration
Swift
convenience public init(nsurl: NSURL)
Parameters
nsurl
URL 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
nsurl
URL that will be used to establish the transport connection.
options
Custom 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
nsurl
URL that will be used to establish the transport connection.
options
Custom options.
request
Custom request.
transport
Custom 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
event
Event name provided with SocketIOEvent.
message
Message to send.
-
Sends a text message to the server.
Declaration
Swift
public final func emit(event: T, withMessage message: String)
Parameters
event
Event name provided with generic type.
message
Message to send.
-
Sends a text message to the server.
Declaration
Swift
public final func emit(event: String, withMessage message: String)
Parameters
event
Event name.
message
Message to send.
-
Sends a list of items to the server.
Declaration
Swift
public final func emit(event: SocketIOEvent, withList list: NSArray)
Parameters
event
Event name provided with SocketIOEvent.
list
List 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
event
Event name provided with generic type.
list
List 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
event
Event name.
list
List 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
event
Event name provided with SocketIOEvent.
dict
Key-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
event
Event name provided with generic type.
dict
Key-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
event
Event name.
dict
Key-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
event
Event name provided with SocketIOEvent.
object
Object that comply SocketIOObject protocol.
-
Sends a object to the server.
Declaration
Swift
public final func emit(event: T, withObject object: SocketIOObject)
Parameters
event
Event name provided with generic type.
object
Object that comply SocketIOObject protocol.
-
Sends a object to the server.
Declaration
Swift
public final func emit(event: String, withObject object: SocketIOObject)
Parameters
event
Event name provided.
object
Object that comply SocketIOObject protocol.
-
Callback fired upon a successful event call.
Declaration
Swift
public final func on(event: SocketIOEvent, withCallback callback: SocketIOCallback) -> SocketIOEventHandler
Parameters
event
Event name provided with SocketIOEvent.
callback
Function of type SocketIOCallback.
-
Callback fired upon a successful event call.
Declaration
Swift
public final func on(event: T, withCallback callback: SocketIOCallback) -> SocketIOEventHandler
Parameters
event
Event name provided with generic type.
callback
Function of type SocketIOCallback.
-
Callback fired upon a successful event call.
Declaration
Swift
public final func on(event: String, withCallback callback: SocketIOCallback) -> SocketIOEventHandler
Parameters
event
Event name provided.
callback
Function of type SocketIOCallback.
-
Callback fired upon any event is called.
Declaration
Swift
public final func onAny(callback: SocketIOCallback) -> SocketIOEventHandler
Parameters
callback
Function of type SocketIOCallback.
-
Remove all callbacks for events.
Declaration
Swift
public final func off() -> SocketIOEventHandler