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

How to set header of the ws connection #43

Closed
cd-yang opened this issue Jun 13, 2022 · 1 comment
Closed

How to set header of the ws connection #43

cd-yang opened this issue Jun 13, 2022 · 1 comment

Comments

@cd-yang
Copy link

cd-yang commented Jun 13, 2022

I'm adding authentication to ws.

In original websocket:
new WebSocket("ws://www.example.com/socketserver", ["access_token", "3gn11Ft0Me8lkqqW2/5uFQ="]);

I'v searched the APIs of README page but found nothing.
How to use websocket-as-promised to pass params to ws connection.

@ryan-nauman
Copy link

new WebSocketAsPromised(this.websocketAddress, {
      createWebSocket: (url) => {
        const ws = new WebSocket(this.websocketAddress, ["access_token", "3gn11Ft0Me8lkqqW2/5uFQ="]);
        ws.binaryType = 'arraybuffer';
        return ws;
      },

@vitalets vitalets closed this as completed Oct 7, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants