jc3213 / download_with_aria2

The browser extenson for aria2 download utility via JSON-RPC
GNU Lesser General Public License v2.1
66 stars 9 forks source link

Use WebSocket for background keep alive connection #10

Closed jc3213 closed 2 years ago

jc3213 commented 2 years ago

Manifest V3 uses service worker not background page. The service worker doesn't have a long life time and setTimeout or setInterval won't work for state indication.

So switch to web socket and use aria2 notification methods shall be better. However, I'm not trying to implement aria2.js, so I have to do the work my selt

jc3213 commented 2 years ago

Oops, web socket notifications works on message event altogether with normal response. and it will be hard to resolve the problem if not use message within extension. hmmm

jc3213 commented 2 years ago

Event if web socket is working, the connection can't keep alive if background.js is inactive. And also, it's hard to indication running downloads when browser is start up.

I'll try again later though

jc3213 commented 2 years ago

I've done the code with Web Socket for indicating aria2 running status. It works well for Firefox using background page, but can't work for Chromium due to the life time of Service Worker.

I wonder if someone can help me with this