Skip to content

Commit 61a896b

Browse files
Merge pull request #320 from pusher/feature/correct-typos
Correct source code and documentation typos
2 parents 291062b + 5a1d4b6 commit 61a896b

File tree

10 files changed

+31
-31
lines changed

10 files changed

+31
-31
lines changed

CHANGELOG.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
7373

7474
### Added
7575

76-
- Added new `bind` functions which accept a callback that receives a `PusherEvent`. A `PusherEvent` represents an event received from the websocket and has properties containing the event name, channel name and data. In addition, `PusherEvent` has a new property, `userId`, which allows you to verify the ID of the user who triggered a client event on a presence channel. You can read more about this feature in [the docs](https://pusher.com/docs/channels/using_channels/events#user-id-in-client-events). All the old `bind` functions are still available for backwards compatibility. The `data` property of `PusherEvent` is not automatically parsed from JSON and you can decide to parse that as required. The parsing behaviour is unchanged for data passed to callbacks bound by the old `bind` functions.
76+
- Added new `bind` functions which accept a callback that receives a `PusherEvent`. A `PusherEvent` represents an event received from the websocket and has properties containing the event name, channel name and data. In addition, `PusherEvent` has a new property, `userId`, which allows you to verify the ID of the user who triggered a client event on a presence channel. You can read more about this feature in [the docs](https://pusher.com/docs/channels/using_channels/events#user-id-in-client-events). All the old `bind` functions are still available for backwards compatibility. The `data` property of `PusherEvent` is not automatically parsed from JSON and you can decide to parse that as required. The parsing behavior is unchanged for data passed to callbacks bound by the old `bind` functions.
7777

7878
### Changed
7979

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -578,7 +578,7 @@ All of this is the case if you have the client option of `autoReconnect` set as
578578
579579
N.B: If the Pusher servers close the websocket with a [Channels Protocol closure code](https://pusher.com/docs/channels/library_auth_reference/pusher-websockets-protocol#connection-closure), then the `autoReconnect` option is ignored, and the reconnection strategy is determined by the specific closure code that was received.
580580
581-
There are a couple of properties on the connection (`PusherConnection`) that you can set that affect how the reconnection behaviour works. These are:
581+
There are a couple of properties on the connection (`PusherConnection`) that you can set that affect how the reconnection behavior works. These are:
582582
583583
- `public var reconnectAttemptsMax: Int? = 6` - if you set this to `nil` then there is no maximum number of reconnect attempts and so attempts will continue to be made with an exponential backoff (based on number of attempts), otherwise only as many attempts as this property's value will be made before the connection's state moves to `.disconnected`
584584
- `public var maxReconnectGapInSeconds: Double? = nil` - if you want to set a maximum length of time (in seconds) between reconnect attempts then set this property appropriately
@@ -804,7 +804,7 @@ let pusherAuth = PusherAuth(auth: yourAuthString, channelData: yourOptionalChann
804804
let chan = self.pusher.subscribe(channelName, auth: pusherAuth)
805805
```
806806

807-
This PusherAuth object can be initialised with just an auth (String) value if the subscription is to a private channel, or both an `auth (String)` and `channelData (String)` pair of values if the subscription is to a presence channel.
807+
This PusherAuth object can be initialized with just an auth (String) value if the subscription is to a private channel, or both an `auth (String)` and `channelData (String)` pair of values if the subscription is to a presence channel.
808808

809809
These `auth` and `channelData` values are the values that you received if the json object created by a call to pusher.authenticate(...) in one of our various server libraries.
810810

@@ -877,7 +877,7 @@ PusherChannel *chan = [pusher subscribeWithChannelName:@"my-channel"];
877877

878878
### Global events
879879

880-
You can attach behaviour to these events regardless of the channel the event is broadcast to.
880+
You can attach behavior to these events regardless of the channel the event is broadcast to.
881881

882882
#### Swift
883883

Sources/Extensions/PusherWebsocketDelegate.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ extension PusherConnection: WebSocketConnectionDelegate {
4949
public func webSocketDidDisconnect(connection: WebSocketConnection,
5050
closeCode: NWProtocolWebSocket.CloseCode,
5151
reason: Data?) {
52-
// Handles setting channel subscriptions to unsubscribed wheter disconnection
52+
// Handles setting channel subscriptions to unsubscribed whether disconnection
5353
// is intentional or not
5454
if connectionState == .disconnecting || connectionState == .connected {
5555
for (_, channel) in self.channels.channels {

Sources/Helpers/PusherLogger.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ internal class PusherLogger {
2525
case networkConnectionViable = "Network connection became viable"
2626
case networkConnectionUnviable = "Network connection became unviable"
2727

28-
// Websockets
28+
// WebSocket
2929

3030
case attemptReconnectionAfterWaiting = "Attempting to reconnect after waiting"
3131
case attemptReconnectionImmediately = "Attempting to reconnect immediately"

Sources/Models/PusherChannel.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ open class PusherChannel: NSObject {
5252
}
5353

5454
/**
55-
Initializes a new PusherChannel with a given name and conenction
55+
Initializes a new PusherChannel with a given name and connection
5656

5757
- parameter name: The name of the channel
5858
- parameter connection: The connection that this channel is relevant to
@@ -81,7 +81,7 @@ open class PusherChannel: NSObject {
8181
@discardableResult open func bind(eventName: String, callback: @escaping (Any?) -> Void) -> String {
8282
return bind(eventName: eventName, eventCallback: { [weak self] (event: PusherEvent) -> Void in
8383
guard let self = self else { return }
84-
// Mimic the old parsing behaviour for backwards compatibility
84+
// Mimic the old parsing behavior for backwards compatibility
8585
let callbackData: Any?
8686
if self.shouldParseJSONForLegacyCallbacks {
8787
if let data = event.dataToJSONObject() {

Sources/Models/PusherChannels.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ import Foundation
4747
}
4848

4949
/**
50-
Create a new PresencPusherChannel, which is returned, and add it to the PusherChannels
50+
Create a new PresencePusherChannel, which is returned, and add it to the PusherChannels
5151
list of channels
5252

5353
- parameter channelName: The name of the channel to create

Sources/Models/PusherPresenceChannel.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ public typealias PusherUserInfoObject = [String: AnyObject]
1010
open var myId: String?
1111

1212
/**
13-
Initializes a new PusherPresenceChannel with a given name, conenction, and optional
13+
Initializes a new PusherPresenceChannel with a given name, connection, and optional
1414
member added and member removed handler functions
1515

1616
- parameter name: The name of the channel

Sources/Services/PusherConnection.swift

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ import NWWebSocket
4646
- parameter key: The Pusher app key
4747
- parameter socket: The websocket object
4848
- parameter url: The URL the connection is made to
49-
- parameter options: A PusherClientOptions instance containing all of the user-speficied
49+
- parameter options: A PusherClientOptions instance containing all of the user-specified
5050
client options
5151
- parameter URLSession: An NSURLSession instance for the connection to use for making
5252
authentication requests
@@ -271,7 +271,7 @@ import NWWebSocket
271271
}
272272

273273
/**
274-
Instantiate a new GloblalChannel instance for the connection
274+
Instantiate a new GlobalChannel instance for the connection
275275
*/
276276
internal func createGlobalChannel() {
277277
self.globalChannel = GlobalChannel(connection: self)
@@ -404,7 +404,7 @@ import NWWebSocket
404404

405405
/**
406406
Schedule a timer that will fire if no pong response is received within the
407-
pongResponseTImeoutInterval
407+
pongResponseTimeoutInterval
408408
*/
409409
fileprivate func setupPongResponseTimeoutTimer() {
410410
pongResponseTimeoutTimer = Timer.scheduledTimer(
@@ -664,11 +664,11 @@ import NWWebSocket
664664
return false
665665
case .endpoint(authEndpoint: let authEndpoint):
666666
let request = requestForAuthValue(from: authEndpoint, socketId: socketId, channelName: channel.name)
667-
sendAuthorisationRequest(request: request, channel: channel, completionHandler: completionHandler)
667+
sendAuthorizationRequest(request: request, channel: channel, completionHandler: completionHandler)
668668
return true
669669
case .authRequestBuilder(authRequestBuilder: let builder):
670670
if let request = builder.requestFor?(socketID: socketId, channelName: channel.name) {
671-
sendAuthorisationRequest(request: request, channel: channel, completionHandler: completionHandler)
671+
sendAuthorizationRequest(request: request, channel: channel, completionHandler: completionHandler)
672672
return true
673673
} else {
674674
let errorMessage = "Authentication request could not be built"
@@ -758,7 +758,7 @@ import NWWebSocket
758758

759759
- parameter endpoint: The authEndpoint to which the request will be made
760760
- parameter socketId: The socketId of the connection's websocket
761-
- parameter channel: The PusherChannel to authenticate subsciption for
761+
- parameter channel: The PusherChannel to authenticate subscription for
762762

763763
- returns: URLRequest object to be used by the function making the auth request
764764
*/
@@ -777,9 +777,9 @@ import NWWebSocket
777777
Send authentication request to the authEndpoint specified
778778

779779
- parameter request: The request to send
780-
- parameter channel: The PusherChannel to authenticate subsciption for
780+
- parameter channel: The PusherChannel to authenticate subscription for
781781
*/
782-
fileprivate func sendAuthorisationRequest(request: URLRequest,
782+
fileprivate func sendAuthorizationRequest(request: URLRequest,
783783
channel: PusherChannel,
784784
completionHandler: @escaping (PusherAuth?, PusherAuthError?) -> Void) {
785785
let task = URLSession.dataTask(with: request, completionHandler: { data, response, sessionError in
@@ -846,7 +846,7 @@ import NWWebSocket
846846

847847
- parameter authString: The auth response as a dictionary
848848
- parameter channelData: The channelData to send along with the auth request
849-
- parameter channel: The PusherChannel to authorize the subsciption for
849+
- parameter channel: The PusherChannel to authorize the subscription for
850850
*/
851851
fileprivate func handleAuthInfo(pusherAuth: PusherAuth, channel: PusherChannel) {
852852
if let decryptionKey = pusherAuth.sharedSecret {
@@ -864,7 +864,7 @@ import NWWebSocket
864864
Handle presence channel auth response and send subscribe message to Pusher API
865865

866866
- parameter auth: The auth string
867-
- parameter channel: The PusherChannel to authorize subsciption for
867+
- parameter channel: The PusherChannel to authorize subscription for
868868
- parameter channelData: The channelData to send along with the auth request
869869
*/
870870
fileprivate func handlePresenceChannelAuth(
@@ -888,7 +888,7 @@ import NWWebSocket
888888
Handle private channel auth response and send subscribe message to Pusher API
889889

890890
- parameter auth: The auth string
891-
- parameter channel: The PusherChannel to authenticate subsciption for
891+
- parameter channel: The PusherChannel to authenticate subscription for
892892
*/
893893
fileprivate func handlePrivateChannelAuth(authValue auth: String, channel: PusherChannel) {
894894
self.sendEvent(

Tests/Integration/PusherClientInitializationTests.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ class ClientInitializationTests: XCTestCase {
4343
XCTAssertEqual(pusher.connection.activityTimeoutInterval, 60, "the activity timeout interval should be 60")
4444
}
4545

46-
func testProvidingEcryptedOptionAsFalse() {
46+
func testProvidingEncryptedOptionAsFalse() {
4747
let options = PusherClientOptions(
4848
useTLS: false
4949
)

Tests/Unit/Models/PrivateEncryptedChannelTests.swift

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -193,7 +193,7 @@ class PrivateEncryptedChannelTests: XCTestCase {
193193
waitForExpectations(timeout: 1)
194194

195195
// set a new expectation for the error delegate for the second event
196-
errorDelegate.expectation = expectation(description: "second event should fail to decrpyt too.")
196+
errorDelegate.expectation = expectation(description: "second event should fail to decrypt too.")
197197

198198
// send a second message
199199
socket.delegate?.webSocketDidReceiveMessage(
@@ -202,7 +202,7 @@ class PrivateEncryptedChannelTests: XCTestCase {
202202
waitForExpectations(timeout: 1)
203203
}
204204

205-
func authorizerReponseSequence(_ authSequence: [PusherAuth]) {
205+
func authorizerResponseSequence(_ authSequence: [PusherAuth]) {
206206
let (pusher, socket) = configurePusherWithAuthMethod(authMethod: AuthMethod.authorizer(authorizer: TestAuthorizer(authSequence)))
207207
pusher.connect()
208208

@@ -238,11 +238,11 @@ class PrivateEncryptedChannelTests: XCTestCase {
238238
}
239239

240240
func testInitialLoadKeyAuthorizerAuthMethod() {
241-
authorizerReponseSequence([validAuth])
241+
authorizerResponseSequence([validAuth])
242242
}
243243

244244
func testReloadKeyAuthorizerAuthMethod() {
245-
authorizerReponseSequence([incorrectSharedSecretAuth, validAuth])
245+
authorizerResponseSequence([incorrectSharedSecretAuth, validAuth])
246246
}
247247

248248
func testInitialLoadKeyRequestBuilder() {
@@ -346,12 +346,12 @@ class PrivateEncryptedChannelTests: XCTestCase {
346346
}
347347

348348
class TestAuthorizer: Authorizer {
349-
var authReponseSequence: [PusherAuth]
350-
public init(_ authReponseSequence: [PusherAuth]) {
351-
self.authReponseSequence = authReponseSequence
349+
var authResponseSequence: [PusherAuth]
350+
public init(_ authResponseSequence: [PusherAuth]) {
351+
self.authResponseSequence = authResponseSequence
352352
}
353353
func fetchAuthValue(socketID: String, channelName: String, completionHandler: @escaping (PusherAuth?) -> Void) {
354-
completionHandler(authReponseSequence.removeFirst())
354+
completionHandler(authResponseSequence.removeFirst())
355355
}
356356
}
357357

@@ -375,7 +375,7 @@ class PrivateEncryptedChannelTests: XCTestCase {
375375
}
376376
}
377377

378-
// utility method to mock an authorizor response with the jsonData provided
378+
// utility method to mock an authorizer response with the jsonData provided
379379
func mockAuthResponse(jsonData: String, pusher: Pusher) {
380380
let urlResponse = HTTPURLResponse(
381381
url: URL(string: "\(authEndpointURL)?channel_name=\(channelName)&socket_id=45481.3166671")!,

0 commit comments

Comments
 (0)