Change sentPing/gotPong to ping/pong since those are already reserved

This commit is contained in:
Erik Little 2017-10-14 10:28:14 -04:00
parent bb1618faaf
commit 1ed87e571d
No known key found for this signature in database
GPG Key ID: 4930B7C5FBC1A69D
3 changed files with 19 additions and 19 deletions

View File

@ -463,7 +463,7 @@ open class SocketIOClient : NSObject, SocketIOClientSpec, SocketEngineClient, So
} }
private func _engineDidReceivePong() { private func _engineDidReceivePong() {
handleClientEvent(.gotPong, data: []) handleClientEvent(.pong, data: [])
} }
/// Called when the sends a ping to the server. /// Called when the sends a ping to the server.
@ -474,7 +474,7 @@ open class SocketIOClient : NSObject, SocketIOClientSpec, SocketEngineClient, So
} }
private func _engineDidSendPing() { private func _engineDidSendPing() {
handleClientEvent(.sentPing, data: []) handleClientEvent(.ping, data: [])
} }
/// Called when socket.io has acked one of our emits. Causes the corresponding ack callback to be called. /// Called when socket.io has acked one of our emits. Causes the corresponding ack callback to be called.

View File

@ -267,16 +267,27 @@ public enum SocketClientEvent : String {
/// ``` /// ```
case error case error
/// Emitted whenever the engine sends a ping.
///
/// Usage:
///
/// ```swift
/// socket.on(clientEvent: .ping) {_, _ in
/// // Maybe keep track of latency?
/// }
/// ```
case ping
/// Emitted whenever the engine gets a pong. /// Emitted whenever the engine gets a pong.
/// ///
/// Usage: /// Usage:
/// ///
/// ```swift /// ```swift
/// socket.on(clientEvent: .gotPong) {_, _ in /// socket.on(clientEvent: .pong) {_, _ in
/// // Maybe keep track of latency? /// // Maybe keep track of latency?
/// } /// }
/// ``` /// ```
case gotPong case pong
/// Emitted when the client begins the reconnection process. /// Emitted when the client begins the reconnection process.
/// ///
@ -300,17 +311,6 @@ public enum SocketClientEvent : String {
/// ``` /// ```
case reconnectAttempt case reconnectAttempt
/// Emitted whenever the engine sends a ping.
///
/// Usage:
///
/// ```swift
/// socket.on(clientEvent: .sentPing) {_, _ in
/// // Maybe keep track of latency?
/// }
/// ```
case sentPing
/// Emitted every time there is a change in the client's status. /// Emitted every time there is a change in the client's status.
/// ///
/// Usage: /// Usage:

View File

@ -413,9 +413,9 @@ class SocketSideEffectTest: XCTestCase {
} }
func testClientCallsSentPingHandler() { func testClientCallsSentPingHandler() {
let expect = expectation(description: "The client should emit a sentPing event") let expect = expectation(description: "The client should emit a ping event")
socket.on(clientEvent: .sentPing) {data, ack in socket.on(clientEvent: .ping) {data, ack in
expect.fulfill() expect.fulfill()
} }
@ -425,9 +425,9 @@ class SocketSideEffectTest: XCTestCase {
} }
func testClientCallsGotPongHandler() { func testClientCallsGotPongHandler() {
let expect = expectation(description: "The client should emit a gotPong event") let expect = expectation(description: "The client should emit a pong event")
socket.on(clientEvent: .gotPong) {data, ack in socket.on(clientEvent: .pong) {data, ack in
expect.fulfill() expect.fulfill()
} }