docs/Classes/SocketRawView.html
public final class SocketRawView : NSObject
Class that gives a backwards compatible way to cause an emit not to recursively check for Data objects.
Usage:
socket.rawEmitView.emit("myEvent", myObject)
`
emit(_:_:)
`
Send an event to the server, with optional data items.
If an error occurs trying to transform items into their socket representation, a SocketClientEvent.error will be emitted. The structure of the error data is [eventName, items, theError]
Swift
public func emit(_ event: String, _ items: SocketData...)
| event |
The event to send.
|
| items |
The items to send with this event. May be left out.
|
`
emit(_:with:)
`
Same as emit, but meant for Objective-C
Swift
@objc
public func emit(_ event: String, with items: [Any])
| event |
The event to send.
|
| items |
The items to send with this event. Send an empty array to send no data.
|
`
emitWithAck(_:_:)
`
Sends a message to the server, requesting an ack.
NOTE : It is up to the server send an ack back, just calling this method does not mean the server will ack. Check that your server’s api will ack the event being sent.
If an error occurs trying to transform items into their socket representation, a SocketClientEvent.error will be emitted. The structure of the error data is [eventName, items, theError]
Example:
socket.emitWithAck("myEvent", 1).timingOut(after: 1) {data in
...
}
Swift
public func emitWithAck(_ event: String, _ items: SocketData...) -> OnAckCallback
| event |
The event to send.
|
| items |
The items to send with this event. May be left out.
|
An OnAckCallback. You must call the timingOut(after:) method before the event will be sent.
`
emitWithAck(_:with:)
`
Same as emitWithAck, but for Objective-C
NOTE : It is up to the server send an ack back, just calling this method does not mean the server will ack. Check that your server’s api will ack the event being sent.
Example:
socket.emitWithAck("myEvent", with: [1]).timingOut(after: 1) {data in
...
}
Swift
@objc
public func emitWithAck(_ event: String, with items: [Any]) -> OnAckCallback
| event |
The event to send.
|
| items |
The items to send with this event. Use [] to send nothing.
|
An OnAckCallback. You must call the timingOut(after:) method before the event will be sent.