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

[ERROR] - [WebSocket connection failed attempt: 1] #77

Open
Molers opened this issue Dec 10, 2022 · 2 comments
Open

[ERROR] - [WebSocket connection failed attempt: 1] #77

Molers opened this issue Dec 10, 2022 · 2 comments
Assignees
Labels
bug Something isn't working

Comments

@Molers
Copy link

Molers commented Dec 10, 2022

Describe the bug
Telegram is banned in China, so I used V2RayN as a proxy, but it still didn't work.
Additional context
Add any other context about the problem here.
1670664330(1)

@Molers Molers added the bug Something isn't working label Dec 10, 2022
@Molers
Copy link
Author

Molers commented Dec 10, 2022

I fix it.

gram-js/gramjs#128

https://gram.js.org/getting-started/authorization#using-mtproxies-and-socks5-proxies

image

const { TelegramClient } = require("telegram");

const apiId = 123456;
const apiHash = "123456abcdfg";

(async () => {
console.log("Loading interactive example...");
const client = new TelegramClient("session_name", apiId, apiHash, {
useWSS: false, // Important. Most proxies cannot use SSL.
proxy: {
ip: "123.123.123.123", // Proxy host (IP or hostname)
port: 123, // Proxy port
MTProxy: false, // Whether it's an MTProxy or a normal Socks one
secret: "00000000000000000000000000000000", // If used MTProxy then you need to provide a secret (or zeros).
socksType: 5, // If used Socks you can choose 4 or 5.
timeout: 2, // Timeout (in seconds) for connection,
},
});
await client.connect();
console.log("You should now be connected.");
})();

@MasterKali06
Copy link

any progress ?!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants