File tree 2 files changed +6
-3
lines changed
2 files changed +6
-3
lines changed Original file line number Diff line number Diff line change @@ -27,6 +27,7 @@ public enum AuthMethod {
27
27
public let autoReconnect : Bool
28
28
public let host : String
29
29
public let port : Int
30
+ public let path : String ?
30
31
public let useTLS : Bool
31
32
public let activityTimeout : TimeInterval ?
32
33
@@ -36,13 +37,15 @@ public enum AuthMethod {
36
37
autoReconnect: Bool = true ,
37
38
host: PusherHost = . host( Constants . API. defaultHost) ,
38
39
port: Int ? = nil ,
40
+ path: String ? = nil ,
39
41
useTLS: Bool = true ,
40
42
activityTimeout: TimeInterval ? = nil
41
43
) {
42
44
self . authMethod = authMethod
43
45
self . attemptToReturnJSONObject = attemptToReturnJSONObject
44
46
self . autoReconnect = autoReconnect
45
47
self . host = host. stringValue
48
+ self . path = path
46
49
self . port = port ?? ( useTLS ? 443 : 80 )
47
50
self . useTLS = useTLS
48
51
self . activityTimeout = activityTimeout
Original file line number Diff line number Diff line change @@ -180,11 +180,11 @@ let CLIENT_NAME = "pusher-websocket-swift"
180
180
*/
181
181
func constructUrl( key: String , options: PusherClientOptions ) -> String {
182
182
var url = " "
183
-
183
+ let additionalPathComponents = options . path ?? " "
184
184
if options. useTLS {
185
- url = " wss:// \( options. host) : \( options. port) /app/ \( key) "
185
+ url = " wss:// \( options. host) : \( options. port) \( additionalPathComponents ) /app/ \( key) "
186
186
} else {
187
- url = " ws:// \( options. host) : \( options. port) /app/ \( key) "
187
+ url = " ws:// \( options. host) : \( options. port) \( additionalPathComponents ) /app/ \( key) "
188
188
}
189
189
return " \( url) ?client= \( CLIENT_NAME) &version= \( VERSION) &protocol= \( PROTOCOL) "
190
190
}
You can’t perform that action at this time.
0 commit comments