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

ReferenceError: ConnectionTCPObfuscated is not defined #88

Closed
isbkch opened this issue May 29, 2021 · 2 comments
Closed

ReferenceError: ConnectionTCPObfuscated is not defined #88

isbkch opened this issue May 29, 2021 · 2 comments

Comments

@isbkch
Copy link

isbkch commented May 29, 2021

Following the documentation here to get my messages https://painor.gitbook.io/gramjs/getting-started/available-methods/getmessages

(async () => {
    const client = new TelegramClient(new StringSession(stringSession), apiId, apiHash, {connection: ConnectionTCPObfuscated})
    await client.connect();
    const msgs = await client.getMessages("me", {
        limit: 10,
    });
    console.log("the total number of msgs are", msgs.total);
    console.log("what we got is ", msgs.length);
    for (const msg of msgs) {
        //console.log("msg is",msg); // this line is very verbose but helpful for debugging
        console.log("msg text is : ", msg.text);
    }
})();

But it's throwing a ReferenceError: ConnectionTCPObfuscated is not defined

what am I doing wrong?

Copy link
Contributor

@isbkch You have to Import ConnectionTCPObfuscated Class

import {ConnectionTCPObfuscated} from "telegram/network";

@isbkch
Copy link
Author

isbkch commented May 29, 2021

Thanks, wish it was mentioned in the docs

@isbkch isbkch closed this as completed May 29, 2021
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

2 participants