diff --git a/README.md b/README.md index 08cd291..2768f95 100644 --- a/README.md +++ b/README.md @@ -41,6 +41,7 @@ a minimal application to connect to a channel and send events. - [`apiKey (string)`](#apikey-string) - [`authEndpoint (string)`](#authendpoint-string) - [`cluster (string)`](#cluster-string) + - [`host (string)`](#host-string) - [`useTLS (bool)`](#usetls-bool) - [Event Callback parameters](#event-callback-parameters) - [`onEvent`](#onevent) @@ -162,6 +163,7 @@ describes available parameters for each platform: | maxReconnectGapInSeconds | ✅ | ✅ | | maxReconnectionAttempts | ✅ | ✅ | | pongTimeout | ✅ | ✅ | +| host | ✅ | ✅ | | proxy | ✅ | ⬜️ | | useTLS | ✅ | ✅ | | authorizerTimeoutInSeconds | ⬜️ | ✅ | @@ -185,6 +187,10 @@ an authorization service](https://pusher.com/docs/channels/server_api/authentica Specifies the cluster that pusher-js should connect to. Here's the full list of [Pusher clusters](https://pusher.com/docs/clusters). If you do not specify a cluster, `mt1` will be used by default. +#### `host (string)` + +Specifies the host that pusher-js should connect to. If you do not specify a host, pusher.com will be used by default. + #### `useTLS (bool)` Whether or not you would like to use TLS encrypted transport or not, default is `true`. diff --git a/android/src/main/java/com/pusherwebsocketreactnative/PusherWebsocketReactNativeModule.kt b/android/src/main/java/com/pusherwebsocketreactnative/PusherWebsocketReactNativeModule.kt index 363808c..eca3ed1 100644 --- a/android/src/main/java/com/pusherwebsocketreactnative/PusherWebsocketReactNativeModule.kt +++ b/android/src/main/java/com/pusherwebsocketreactnative/PusherWebsocketReactNativeModule.kt @@ -52,6 +52,7 @@ class PusherWebsocketReactNativeModule(reactContext: ReactApplicationContext) : pusher!!.disconnect() } val options = PusherOptions() + if (arguments.hasKey("host")) options.setHost(arguments.getString("host")) if (arguments.hasKey("cluster")) options.setCluster(arguments.getString("cluster")) if (arguments.hasKey("useTLS")) options.isUseTLS = arguments.getBoolean("useTLS") diff --git a/example/ios/Podfile.lock b/example/ios/Podfile.lock index 7060b14..2fb9907 100644 --- a/example/ios/Podfile.lock +++ b/example/ios/Podfile.lock @@ -77,7 +77,7 @@ PODS: - libevent (2.1.12) - NWWebSocket (0.5.2) - OpenSSL-Universal (1.1.1100) - - pusher-websocket-react-native (1.1.1): + - pusher-websocket-react-native (1.2.2): - PusherSwift (~> 10.1.1) - React - PusherSwift (10.1.1): @@ -544,7 +544,7 @@ EXTERNAL SOURCES: SPEC CHECKSUMS: boost: a7c83b31436843459a1961bfd74b96033dc77234 CocoaAsyncSocket: 065fd1e645c7abab64f7a6a2007a48038fdc6a99 - DoubleConversion: 831926d9b8bf8166fd87886c4abab286c2422662 + DoubleConversion: 5189b271737e1565bdce30deb4a08d647e3f5f54 FBLazyVector: affa4ba1bfdaac110a789192f4d452b053a86624 FBReactNativeSpec: fe8b5f1429cfe83a8d72dc8ed61dc7704cac8745 Flipper: 26fc4b7382499f1281eb8cb921e5c3ad6de91fe0 @@ -557,12 +557,12 @@ SPEC CHECKSUMS: Flipper-RSocket: d9d9ade67cbecf6ac10730304bf5607266dd2541 FlipperKit: cbdee19bdd4e7f05472a66ce290f1b729ba3cb86 fmt: ff9d55029c625d3757ed641535fd4a75fedc7ce9 - glog: 476ee3e89abb49e07f822b48323c51c57124b572 + glog: 04b94705f318337d7ead9e6d17c019bd9b1f6b1b hermes-engine: 7fe5fc6ef707b7fdcb161b63898ec500e285653d libevent: 4049cae6c81cdb3654a443be001fb9bdceff7913 NWWebSocket: 21f0c73639815da3272862c912275b26102aa80c OpenSSL-Universal: ebc357f1e6bc71fa463ccb2fe676756aff50e88c - pusher-websocket-react-native: f39fffc44df8914ca5c9382a0acb446130d9946e + pusher-websocket-react-native: ca8f78071843c907a13c364c1c0e21c05dbde934 PusherSwift: 70a805a950ab49381e164c54ac19c3b9c1d288e3 RCT-Folly: 0080d0a6ebf2577475bda044aa59e2ca1f909cda RCTRequired: 21229f84411088e5d8538f21212de49e46cc83e2 diff --git a/src/index.tsx b/src/index.tsx index e963e00..2a0be4e 100644 --- a/src/index.tsx +++ b/src/index.tsx @@ -129,7 +129,8 @@ export class Pusher { public init(args: { apiKey: string; - cluster: string; + cluster?: string; + host?: string; authEndpoint?: string; useTLS?: boolean; activityTimeout?: Number; @@ -255,6 +256,7 @@ export class Pusher { return PusherWebsocketReactNative.initialize({ apiKey: args.apiKey, cluster: args.cluster, + host: args.host, authEndpoint: args.authEndpoint, useTLS: args.useTLS, activityTimeout: args.activityTimeout,