Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add host parameter #100

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -162,6 +163,7 @@ describes available parameters for each platform:
| maxReconnectGapInSeconds | ✅ | ✅ |
| maxReconnectionAttempts | ✅ | ✅ |
| pongTimeout | ✅ | ✅ |
| host | ✅ | ✅ |
| proxy | ✅ | ⬜️ |
| useTLS | ✅ | ✅ |
| authorizerTimeoutInSeconds | ⬜️ | ✅ |
Expand All @@ -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`.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down
8 changes: 4 additions & 4 deletions example/ios/Podfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down Expand Up @@ -544,7 +544,7 @@ EXTERNAL SOURCES:
SPEC CHECKSUMS:
boost: a7c83b31436843459a1961bfd74b96033dc77234
CocoaAsyncSocket: 065fd1e645c7abab64f7a6a2007a48038fdc6a99
DoubleConversion: 831926d9b8bf8166fd87886c4abab286c2422662
DoubleConversion: 5189b271737e1565bdce30deb4a08d647e3f5f54
FBLazyVector: affa4ba1bfdaac110a789192f4d452b053a86624
FBReactNativeSpec: fe8b5f1429cfe83a8d72dc8ed61dc7704cac8745
Flipper: 26fc4b7382499f1281eb8cb921e5c3ad6de91fe0
Expand All @@ -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
Expand Down
4 changes: 3 additions & 1 deletion src/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,8 @@ export class Pusher {

public init(args: {
apiKey: string;
cluster: string;
cluster?: string;
host?: string;
authEndpoint?: string;
useTLS?: boolean;
activityTimeout?: Number;
Expand Down Expand Up @@ -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,
Expand Down