gramjs
gramjs copied to clipboard
change ip4 to domain to fix wss in browser
On https pages connector switches to WSS but for TLS validation on browsers wss url domain most match certificate domain. I just apply it.
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.
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/