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

Fix websocket client adding /websocket to the end of urls #222

Merged
merged 2 commits into from
Jan 24, 2024
Merged
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
2 changes: 2 additions & 0 deletions packages/node/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [Unreleased]
### Fixed
- `/websocket` being appended to all websocket urls causing the indexer to hang (#222)

## [3.4.6] - 2023-12-25
### Fixed
Expand Down
8 changes: 0 additions & 8 deletions packages/node/src/indexer/rpc-clients/WebsocketClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -192,16 +192,8 @@ export class WebsocketClient implements RpcStreamingClient {
baseUrl: string,
onError: (err: any) => void = defaultErrorHandler,
) {
// accept host.name:port and assume ws protocol

const url = new URL(baseUrl);

// Add websocket to pathname
if (!url.pathname.includes('websocket')) {
// make sure we don't end up with ...//websocket
url.pathname += url.pathname.endsWith('/') ? 'websocket' : '/websocket';
}

// Ensure protocol
if (!hasProtocol(baseUrl)) {
url.protocol = 'ws';
Expand Down
Loading