tdlib / td

Cross-platform library for building Telegram clients
https://core.telegram.org/tdlib
Boost Software License 1.0
7.13k stars 1.45k forks source link

Web browser in the browser and TDLib #508

Closed isopen closed 5 years ago

isopen commented 5 years ago

Guys. Does anyone have a implementation in web worker? https://github.com/tdlib/td/issues/18

levlam commented 5 years ago

You can see one such implementation in https://evgeny-nadymov.github.io/telegram-react/. We will make corresponding npm package public after it is fully-documented and we implement other pending TDLib tasks.

isopen commented 5 years ago

Great example of use, but there are moments. For example, the CPU load is 100% after reloading the page. The first start on a mobile device is very long. On the PC, the first launch is also not fast. Maybe we should think about lazy loading? (If it is even possible in this case)

levlam commented 5 years ago

TDLib 1.4.0 includes an example of TDLib usage in a browser. You can also use NPM package tdweb if you don't want to build TDLib yourself.

theChengundertheQun commented 4 years ago

@isopen hey, I got a new problem, I just like https://evgeny-nadymov.github.io/telegram-react/ to use tdweb, but when I run my project, I just got a error in my console: Manifest: Line: 1, column: 1, Syntax error. Uncaught SyntaxError: Unexpected token '<' And I think it is because teweb.js line 231: new Worker(xxxx.worker.js), but I have no idea how to fix it. And I use create-react-app to create my project. So have any idea about that? Thanks for your time

isopen commented 4 years ago

Mode wasm or js?

Possible case of invalid json in Manifest.

theChengundertheQun commented 4 years ago

Mode wasm or js? js

isopen commented 4 years ago

js slows down more than wasm. I use wasm in my project

theChengundertheQun commented 4 years ago

js slows down more than wasm. I use wasm in my project

Wait, I use the npm tdweb, and the tdweb.js import the wasm.

oliverox commented 3 years ago

@isopen hey, I got a new problem, I just like https://evgeny-nadymov.github.io/telegram-react/ to use tdweb, but when I run my project, I just got a error in my console: Manifest: Line: 1, column: 1, Syntax error. Uncaught SyntaxError: Unexpected token '<' And I think it is because teweb.js line 231: new Worker(xxxx.worker.js), but I have no idea how to fix it. And I use create-react-app to create my project. So have any idea about that? Thanks for your time

This issue is because you are trying to load your service worker file from a different root directory. Since you are using create-react-app, you need to make sure your service worker is being placed in your 'public' folder and can be accessed by pasting its full url in the browser. If you can't access it, then you'll see the error you are seeing because create-react-app tries to load index.html first. Nothing to do with manifest issue.