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

Web browser in the browser and TDLib #508

Closed
isopen opened this issue Mar 12, 2019 · 9 comments
Closed

Web browser in the browser and TDLib #508

isopen opened this issue Mar 12, 2019 · 9 comments

Comments

@isopen
Copy link
Contributor

isopen commented Mar 12, 2019

Guys. Does anyone have a implementation in web worker?
#18

@levlam
Copy link
Contributor

levlam commented Mar 12, 2019

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
Copy link
Contributor Author

isopen commented Mar 13, 2019

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
Copy link
Contributor

levlam commented May 1, 2019

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.

@levlam levlam closed this as completed May 1, 2019
@theChengundertheQun
Copy link

@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
Copy link
Contributor Author

isopen commented Jul 6, 2020

Mode wasm or js?

Possible case of invalid json in Manifest.

@theChengundertheQun
Copy link

Mode wasm or js?
js

@isopen
Copy link
Contributor Author

isopen commented Jul 6, 2020

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

@theChengundertheQun
Copy link

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
Copy link

@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.

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

4 participants