Back to Socket Io Client Swift

SocketEnginePollable

docs/Protocols/SocketEnginePollable.html

16.1.12.9 KB
Original Source

SocketEnginePollable

public protocol SocketEnginePollable : SocketEngineSpec

Protocol that is used to implement socket.io polling support

Properties

`

                invalidated
                `

true If engine’s session has been invalidated.

Declaration

Swift

var invalidated: Bool { get }

`

                postWait
                `

A queue of engine.io messages waiting for POSTing

You should not touch this directly

Declaration

Swift

var postWait: [Post] { get set }

`

                session
                `

The URLSession that will be used for polling.

Declaration

Swift

var session: URLSession? { get }

`

                waitingForPoll
                `

true if there is an outstanding poll. Trying to poll before the first is done will cause socket.io to disconnect us.

Do not touch this directly

Declaration

Swift

var waitingForPoll: Bool { get set }

`

                waitingForPost
                `

true if there is an outstanding post. Trying to post before the first is done will cause socket.io to disconnect us.

Do not touch this directly

Declaration

Swift

var waitingForPost: Bool { get set }

Methods

`

                doPoll()
                ` Default implementation 

Call to send a long-polling request.

You shouldn’t need to call this directly, the engine should automatically maintain a long-poll request.

Default Implementation

Call to send a long-polling request.

You shouldn’t need to call this directly, the engine should automatically maintain a long-poll request.

Declaration

Swift

func doPoll()

`

                sendPollMessage(_:withType:withData:completion:)
                ` Default implementation 

Sends an engine.io message through the polling transport.

You shouldn’t call this directly, instead call the write method on SocketEngine.

Default Implementation

Sends an engine.io message through the polling transport.

You shouldn’t call this directly, instead call the write method on SocketEngine.

Declaration

Swift

func sendPollMessage(_ message: String, withType type: SocketEnginePacketType, withData datas: [Data], completion: (() -> ())?)

Parameters

| message |

The message to send.

| | withType |

The type of message to send.

| | withData |

The data associated with this message.

|

`

                stopPolling()
                ` Default implementation 

Call to stop polling and invalidate the URLSession.

Default Implementation

Call to stop polling and invalidate the URLSession.

Declaration

Swift

func stopPolling()