Skip to content

Commit

Permalink
nodejs: fix connector for custom port (#488)
Browse files Browse the repository at this point in the history
  • Loading branch information
fanatid authored Dec 11, 2024
1 parent dae08b2 commit 895e1db
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 5 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ The minor version will be incremented upon a breaking change and the patch versi

### Fixes

- nodejs: fix connector for custom port ([#488](https://github.com/rpcpool/yellowstone-grpc/pull/48*))

### Features

- proto: add tonic feature ([#474](https://github.com/rpcpool/yellowstone-grpc/pull/474))
Expand Down
2 changes: 1 addition & 1 deletion examples/typescript/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions yellowstone-grpc-client-nodejs/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion yellowstone-grpc-client-nodejs/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@triton-one/yellowstone-grpc",
"version": "1.3.0",
"version": "1.3.1",
"license": "Apache-2.0",
"author": "Triton One",
"description": "Yellowstone gRPC Geyser Node.js Client",
Expand Down
15 changes: 14 additions & 1 deletion yellowstone-grpc-client-nodejs/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,15 @@ export default class Client {
let creds: ChannelCredentials;

const endpointURL = new URL(endpoint);
let port = endpointURL.port;
if (port == "") {
switch (endpointURL.protocol) {
case "https:":
port = "443";
case "http:":
port = "80";
}
}

// Check if we need to use TLS.
if (endpointURL.protocol === "https:") {
Expand All @@ -121,7 +130,11 @@ export default class Client {
}
}

this._client = new GeyserClient(endpointURL.host, creds, channelOptions);
this._client = new GeyserClient(
`${endpointURL.host}:${port}`,
creds,
channelOptions
);
}

private _getInsecureMetadata(): Metadata {
Expand Down

0 comments on commit 895e1db

Please sign in to comment.