gramjs icon indicating copy to clipboard operation
gramjs copied to clipboard

change ip4 to domain to fix wss in browser

Open kingofnull opened this issue 3 years ago • 2 comments

On https pages connector switches to WSS but for TLS validation on browsers wss url domain most match certificate domain. I just apply it.

kingofnull avatar Nov 14 '21 16:11 kingofnull

I don't think this is the correct fix for it. In browsers, it should pickup vesta.web.telegram.org as the default URL. For Node it should be an IP not a URL.

painor avatar Nov 14 '21 18:11 painor

But it doesn't and setting it manually fix the connectivity problem:

    client.session.setDC(4, 'kws4.web.telegram.org', 443);

and I found it from https://web.telegram.org/k/ and it return exact IP as current IP in gramjs config.

I want to help to improve library. Please test library on https web page and if it worked you just ignore this commit.

I built browser build and loaded it to this page (its a https one) you can test connection on it yourself:

https://kingofnull.github.io/gramjs-browser-build/

kingofnull avatar Nov 18 '21 09:11 kingofnull