@@ -218,7 +218,7 @@ import NWWebSocket
218
218
- parameter data: The data to be stringified and sent
219
219
- parameter channel: The name of the channel
220
220
*/
221
- fileprivate func sendClientEvent( event: String , data: Any , channel: PusherChannel ? ) {
221
+ private func sendClientEvent( event: String , data: Any , channel: PusherChannel ? ) {
222
222
guard let channel = channel else {
223
223
return
224
224
}
@@ -242,7 +242,7 @@ import NWWebSocket
242
242
243
243
- returns: A JSON-stringified version of the value
244
244
*/
245
- fileprivate func JSONStringify( _ value: Any ) -> String {
245
+ private func JSONStringify( _ value: Any ) -> String {
246
246
if JSONSerialization . isValidJSONObject ( value) {
247
247
do {
248
248
let data = try JSONSerialization . data ( withJSONObject: value, options: [ ] )
@@ -341,7 +341,7 @@ import NWWebSocket
341
341
/**
342
342
Update connection state and attempt subscriptions to unsubscribed channels
343
343
*/
344
- fileprivate func setConnectionStateToConnectedAndAttemptSubscriptions( ) {
344
+ private func setConnectionStateToConnectedAndAttemptSubscriptions( ) {
345
345
if self . connectionEstablishedMessageReceived &&
346
346
self . socketConnected &&
347
347
self . connectionState != . connected {
@@ -355,7 +355,7 @@ import NWWebSocket
355
355
reset connection-related state to initial state, and initiate reconnect
356
356
process
357
357
*/
358
- fileprivate func resetConnectionAndAttemptReconnect( ) {
358
+ private func resetConnectionAndAttemptReconnect( ) {
359
359
if connectionState != . disconnected {
360
360
updateConnectionState ( to: . disconnected)
361
361
}
@@ -395,7 +395,7 @@ import NWWebSocket
395
395
Schedule a timer to be fired if no activity occurs over the socket within
396
396
the activityTimeoutInterval
397
397
*/
398
- fileprivate func establishActivityTimeoutTimer( ) {
398
+ private func establishActivityTimeoutTimer( ) {
399
399
self . activityTimeoutTimer = Timer . scheduledTimer (
400
400
timeInterval: self . activityTimeoutInterval,
401
401
target: self ,
@@ -408,7 +408,7 @@ import NWWebSocket
408
408
/**
409
409
Send a ping to the server
410
410
*/
411
- @objc fileprivate func sendPing( ) {
411
+ @objc private func sendPing( ) {
412
412
socket. ping ( )
413
413
PusherLogger . shared. debug ( for: . pingSent)
414
414
self . setupPongResponseTimeoutTimer ( )
@@ -418,7 +418,7 @@ import NWWebSocket
418
418
Schedule a timer that will fire if no pong response is received within the
419
419
pongResponseTimeoutInterval
420
420
*/
421
- fileprivate func setupPongResponseTimeoutTimer( ) {
421
+ private func setupPongResponseTimeoutTimer( ) {
422
422
pongResponseTimeoutTimer = Timer . scheduledTimer (
423
423
timeInterval: pongResponseTimeoutInterval,
424
424
target: self ,
@@ -432,7 +432,7 @@ import NWWebSocket
432
432
Invalidate the pongResponseTimeoutTimer and set connection state to disconnected
433
433
as well as marking channels as unsubscribed
434
434
*/
435
- @objc fileprivate func cleanupAfterNoPongResponse( ) {
435
+ @objc private func cleanupAfterNoPongResponse( ) {
436
436
pongResponseTimeoutTimer? . invalidate ( )
437
437
pongResponseTimeoutTimer = nil
438
438
resetConnectionAndAttemptReconnect ( )
@@ -444,7 +444,7 @@ import NWWebSocket
444
444
445
445
- parameter json: The PusherEventJSON containing successful subscription data
446
446
*/
447
- fileprivate func handleSubscriptionSucceededEvent( event: PusherEvent ) {
447
+ private func handleSubscriptionSucceededEvent( event: PusherEvent ) {
448
448
guard let channelName = event. channelName,
449
449
let chan = self . channels. find ( name: channelName) else {
450
450
return
@@ -488,7 +488,7 @@ import NWWebSocket
488
488
489
489
- parameter event: The event to be processed
490
490
*/
491
- fileprivate func handleConnectionEstablishedEvent( event: PusherEvent ) {
491
+ private func handleConnectionEstablishedEvent( event: PusherEvent ) {
492
492
guard let connectionData = event. dataToJSONObject ( ) as? [ String : Any ] ,
493
493
let socketId = connectionData [ Constants . JSONKeys. socketId] as? String else {
494
494
return
@@ -512,7 +512,7 @@ import NWWebSocket
512
512
Attempts to make subscriptions that couldn't be attempted while the
513
513
connection was not in a connected state
514
514
*/
515
- fileprivate func attemptSubscriptionsToUnsubscribedChannels( ) {
515
+ private func attemptSubscriptionsToUnsubscribedChannels( ) {
516
516
for (_, channel) in self . channels. channels {
517
517
if !self . authorize ( channel, auth: channel. auth) {
518
518
PusherLogger . shared. debug ( for: . unableToSubscribeToChannel,
@@ -526,7 +526,7 @@ import NWWebSocket
526
526
527
527
- parameter event: The event to be processed
528
528
*/
529
- fileprivate func handleMemberAddedEvent( event: PusherEvent ) {
529
+ private func handleMemberAddedEvent( event: PusherEvent ) {
530
530
guard let channelName = event. channelName,
531
531
let chan = self . channels. find ( name: channelName) as? PusherPresenceChannel else {
532
532
return
@@ -544,7 +544,7 @@ import NWWebSocket
544
544
545
545
- parameter event: The event to be processed
546
546
*/
547
- fileprivate func handleMemberRemovedEvent( event: PusherEvent ) {
547
+ private func handleMemberRemovedEvent( event: PusherEvent ) {
548
548
guard let channelName = event. channelName,
549
549
let chan = self . channels. find ( name: channelName) as? PusherPresenceChannel else {
550
550
return
@@ -574,7 +574,7 @@ import NWWebSocket
574
574
- parameter channelName: The name of channel for which authorization failed
575
575
- parameter data: The error returned by the auth endpoint
576
576
*/
577
- fileprivate func handleAuthorizationError( forChannel channelName: String , error: PusherAuthError ) {
577
+ private func handleAuthorizationError( forChannel channelName: String , error: PusherAuthError ) {
578
578
let eventName = Constants . Events. Pusher. subscriptionError
579
579
let json = [
580
580
Constants . JSONKeys. event: eventName,
@@ -631,7 +631,7 @@ import NWWebSocket
631
631
632
632
- parameter event: The incoming event
633
633
*/
634
- fileprivate func callGlobalCallbacks( event: PusherEvent ) {
634
+ private func callGlobalCallbacks( event: PusherEvent ) {
635
635
globalChannel? . handleGlobalEvent ( event: event)
636
636
globalChannel? . handleGlobalEventLegacy ( event: event. raw)
637
637
}
@@ -647,7 +647,7 @@ import NWWebSocket
647
647
- returns: A Bool indicating whether or not the authentication request was made
648
648
successfully
649
649
*/
650
- fileprivate func authorize( _ channel: PusherChannel , auth: PusherAuth ? = nil ) -> Bool {
650
+ private func authorize( _ channel: PusherChannel , auth: PusherAuth ? = nil ) -> Bool {
651
651
if channel. type != . presence && channel. type != . private {
652
652
subscribeToNormalChannel ( channel)
653
653
return true
@@ -673,8 +673,8 @@ import NWWebSocket
673
673
}
674
674
}
675
675
676
- fileprivate func requestPusherAuthFromAuthMethod( channel: PusherChannel ,
677
- completionHandler: @escaping ( PusherAuth ? , PusherAuthError ? ) -> Void ) -> Bool {
676
+ private func requestPusherAuthFromAuthMethod( channel: PusherChannel ,
677
+ completionHandler: @escaping ( PusherAuth ? , PusherAuthError ? ) -> Void ) -> Bool {
678
678
guard let socketId = self . socketId else {
679
679
let message = " socketId value not found. You may not be connected. "
680
680
completionHandler ( nil , PusherAuthError ( kind: . notConnected, message: message) )
@@ -751,7 +751,7 @@ import NWWebSocket
751
751
752
752
- returns: A JSON stringified user data object
753
753
*/
754
- fileprivate func getUserDataJSON( ) -> String {
754
+ private func getUserDataJSON( ) -> String {
755
755
if let userDataFetcher = self . userDataFetcher {
756
756
let userData = userDataFetcher ( )
757
757
if let userInfo: Any = userData. userInfo {
@@ -775,7 +775,7 @@ import NWWebSocket
775
775
776
776
- parameter channel: The PusherChannel to subscribe to
777
777
*/
778
- fileprivate func subscribeToNormalChannel( _ channel: PusherChannel ) {
778
+ private func subscribeToNormalChannel( _ channel: PusherChannel ) {
779
779
self . sendEvent (
780
780
event: Constants . Events. Pusher. subscribe,
781
781
data: [
@@ -793,7 +793,7 @@ import NWWebSocket
793
793
794
794
- returns: URLRequest object to be used by the function making the auth request
795
795
*/
796
- fileprivate func requestForAuthValue( from endpoint: String , socketId: String , channelName: String ) -> URLRequest {
796
+ private func requestForAuthValue( from endpoint: String , socketId: String , channelName: String ) -> URLRequest {
797
797
let allowedCharacterSet = CharacterSet ( charactersIn: " !*'();:@&=+$,/?%#[] " ) . inverted
798
798
let encodedChannelName = channelName. addingPercentEncoding ( withAllowedCharacters: allowedCharacterSet) ?? channelName
799
799
@@ -810,9 +810,9 @@ import NWWebSocket
810
810
- parameter request: The request to send
811
811
- parameter channel: The PusherChannel to authenticate subscription for
812
812
*/
813
- fileprivate func sendAuthorizationRequest( request: URLRequest ,
814
- channel: PusherChannel ,
815
- completionHandler: @escaping ( PusherAuth ? , PusherAuthError ? ) -> Void ) {
813
+ private func sendAuthorizationRequest( request: URLRequest ,
814
+ channel: PusherChannel ,
815
+ completionHandler: @escaping ( PusherAuth ? , PusherAuthError ? ) -> Void ) {
816
816
let task = URLSession . dataTask ( with: request, completionHandler: { data, response, sessionError in
817
817
if let error = sessionError {
818
818
let message = " Error authorizing channel [ \( channel. name) ]: \( error) "
@@ -879,7 +879,7 @@ import NWWebSocket
879
879
- parameter channelData: The channelData to send along with the auth request
880
880
- parameter channel: The PusherChannel to authorize the subscription for
881
881
*/
882
- fileprivate func handleAuthInfo( pusherAuth: PusherAuth , channel: PusherChannel ) {
882
+ private func handleAuthInfo( pusherAuth: PusherAuth , channel: PusherChannel ) {
883
883
if let decryptionKey = pusherAuth. sharedSecret {
884
884
channel. decryptionKey = decryptionKey
885
885
}
@@ -898,7 +898,7 @@ import NWWebSocket
898
898
- parameter channel: The PusherChannel to authorize subscription for
899
899
- parameter channelData: The channelData to send along with the auth request
900
900
*/
901
- fileprivate func handlePresenceChannelAuth(
901
+ private func handlePresenceChannelAuth(
902
902
authValue: String ,
903
903
channel: PusherChannel ,
904
904
channelData: String
@@ -921,7 +921,7 @@ import NWWebSocket
921
921
- parameter auth: The auth string
922
922
- parameter channel: The PusherChannel to authenticate subscription for
923
923
*/
924
- fileprivate func handlePrivateChannelAuth( authValue auth: String , channel: PusherChannel ) {
924
+ private func handlePrivateChannelAuth( authValue auth: String , channel: PusherChannel ) {
925
925
self . sendEvent (
926
926
event: Constants . Events. Pusher. subscribe,
927
927
data: [
0 commit comments