asyncapi / asyncapi/generator

JavaScript WebSocket client template doesn't support query parameters from channel bindings

Open
#1,957 8 comments 0 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
1.1k
Forks
397
Avg merge
1d 7h
Merged PRs (30d)
25

Description

## Problem
The JavaScript WebSocket client template doesn't extract or use query parameters defined in channel bindings, unlike the Python template. This prevents authentication tokens and other important parameters from being passed to WebSocket connections.

## Expected Behavior
When a channel defines query parameters in its bindings (e.g., `auth_token` for authentication), the generated JavaScript client should:
1. Accept these parameters in the constructor
2. Automatically append them to the WebSocket URL as query strings

Example:
```javascript
// Expected generated code
constructor(url, auth_token) {
const params = {};
if (auth_token) params['auth_token'] = auth_token;
const qs = new URLSearchParams(params).toString();
this.url = qs ? `${url}?${qs}` : url;
}

Contributor guide

Open the contributing guide

Research direction

Start by locating the JavaScript WebSocket client template and comparing its channel-binding handling with the Python template. Trace how query parameters are represented, then verify that generated constructors accept them and append them to the WebSocket URL, including the no-parameters case.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
tooling
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
62/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.