reisxd / TizenTube

A TizenBrew module to remove ads and add support for SponsorBlock for your Tizen TV.
https://tizentube.vercel.app
GNU General Public License v3.0
507 stars 43 forks source link

TV after reboot: Can't reconnect to server #34

Closed funkyfunked closed 8 months ago

funkyfunked commented 9 months ago

Hello,

I'm running the node server on Ubuntu 22.04, and it works GREAT connecting for the first time, however:

If I turn off the TV, then turn it on again the Launcher-app is running in a time-out, or doesn't do anything at all.

It seems the Launcher on the TV cannot reconnect to the server after a reboot of the TV.

If i restart the server the Launcher can connect and run perfectly again - until the next reboot and so on.

I ran 'node .' in debug mode on the server. Here is the output. I started the Launcher the first time connecting to fresh started server and played a video. After that I rebooted the TV and tried to run the Launcher-app again. The Launcher won't start anymore.

Anyone else experiencing this or is it just me? Why can't the Launcher reconnect?

Here is the complete log output:

TizenTube$ NODE_DEBUG=cluster,net,http,fs,tls,module,timers node . MODULE 681033: load built-in module node:fs (node:681033) ExperimentalWarning: Importing JSON modules is an experimental feature and might change at any time (Use node --trace-warnings ... to show where the warning was created) MODULE 681033: load built-in module node:http MODULE 681033: load built-in module node:https MODULE 681033: load built-in module node:zlib MODULE 681033: load built-in module node:stream MODULE 681033: load built-in module node:buffer MODULE 681033: load built-in module node:util MODULE 681033: load built-in module node:url MODULE 681033: load built-in module node:path MODULE 681033: load built-in module node:net MODULE 681033: looking for "/home/USER/Scripts/tizentube/TizenTube/node_modules/ws/lib/stream.js" in ["/home/USER/.node_modules","/home/USER/.node_libraries","/usr/lib/node"] MODULE 681033: load "/home/USER/Scripts/tizentube/TizenTube/node_modules/ws/lib/stream.js" for module "/home/USER/Scripts/tizentube/TizenTube/node_modules/ws/lib/stream.js" MODULE 681033: Module._load REQUEST stream parent: /home/USER/Scripts/tizentube/TizenTube/node_modules/ws/lib/stream.js MODULE 681033: load built-in module stream MODULE 681033: looking for "/home/USER/Scripts/tizentube/TizenTube/node_modules/ws/lib/receiver.js" in ["/home/USER/.node_modules","/home/USER/.node_libraries","/usr/lib/node"] MODULE 681033: load "/home/USER/Scripts/tizentube/TizenTube/node_modules/ws/lib/receiver.js" for module "/home/USER/Scripts/tizentube/TizenTube/node_modules/ws/lib/receiver.js" MODULE 681033: Module._load REQUEST stream parent: /home/USER/Scripts/tizentube/TizenTube/node_modules/ws/lib/receiver.js MODULE 681033: load built-in module stream MODULE 681033: Module._load REQUEST ./permessage-deflate parent: /home/USER/Scripts/tizentube/TizenTube/node_modules/ws/lib/receiver.js MODULE 681033: RELATIVE: requested: ./permessage-deflate from parent.id /home/USER/Scripts/tizentube/TizenTube/node_modules/ws/lib/receiver.js MODULE 681033: looking for ["/home/USER/Scripts/tizentube/TizenTube/node_modules/ws/lib"] MODULE 681033: load "/home/USER/Scripts/tizentube/TizenTube/node_modules/ws/lib/permessage-deflate.js" for module "/home/USER/Scripts/tizentube/TizenTube/node_modules/ws/lib/permessage-deflate.js" MODULE 681033: Module._load REQUEST zlib parent: /home/USER/Scripts/tizentube/TizenTube/node_modules/ws/lib/permessage-deflate.js MODULE 681033: load built-in module zlib MODULE 681033: Module._load REQUEST ./buffer-util parent: /home/USER/Scripts/tizentube/TizenTube/node_modules/ws/lib/permessage-deflate.js MODULE 681033: RELATIVE: requested: ./buffer-util from parent.id /home/USER/Scripts/tizentube/TizenTube/node_modules/ws/lib/permessage-deflate.js MODULE 681033: looking for ["/home/USER/Scripts/tizentube/TizenTube/node_modules/ws/lib"] MODULE 681033: load "/home/USER/Scripts/tizentube/TizenTube/node_modules/ws/lib/buffer-util.js" for module "/home/USER/Scripts/tizentube/TizenTube/node_modules/ws/lib/buffer-util.js" MODULE 681033: Module._load REQUEST ./constants parent: /home/USER/Scripts/tizentube/TizenTube/node_modules/ws/lib/buffer-util.js MODULE 681033: RELATIVE: requested: ./constants from parent.id /home/USER/Scripts/tizentube/TizenTube/node_modules/ws/lib/buffer-util.js MODULE 681033: looking for ["/home/USER/Scripts/tizentube/TizenTube/node_modules/ws/lib"] MODULE 681033: load "/home/USER/Scripts/tizentube/TizenTube/node_modules/ws/lib/constants.js" for module "/home/USER/Scripts/tizentube/TizenTube/node_modules/ws/lib/constants.js" MODULE 681033: Module._load REQUEST bufferutil parent: /home/USER/Scripts/tizentube/TizenTube/node_modules/ws/lib/buffer-util.js MODULE 681033: looking for "bufferutil" in ["/home/USER/Scripts/tizentube/TizenTube/node_modules/ws/lib/node_modules","/home/USER/Scripts/tizentube/TizenTube/node_modules/ws/node_modules","/home/USER/Scripts/tizentube/TizenTube/node_modules","/home/USER/Scripts/tizentube/node_modules","/home/USER/Scripts/node_modules","/home/USER/node_modules","/home/node_modules","/node_modules","/home/USER/.node_modules","/home/USER/.node_libraries","/usr/lib/node"] MODULE 681033: Module._load REQUEST ./limiter parent: /home/USER/Scripts/tizentube/TizenTube/node_modules/ws/lib/permessage-deflate.js MODULE 681033: RELATIVE: requested: ./limiter from parent.id /home/USER/Scripts/tizentube/TizenTube/node_modules/ws/lib/permessage-deflate.js MODULE 681033: looking for ["/home/USER/Scripts/tizentube/TizenTube/node_modules/ws/lib"] MODULE 681033: load "/home/USER/Scripts/tizentube/TizenTube/node_modules/ws/lib/limiter.js" for module "/home/USER/Scripts/tizentube/TizenTube/node_modules/ws/lib/limiter.js" MODULE 681033: Module._load REQUEST ./constants parent: /home/USER/Scripts/tizentube/TizenTube/node_modules/ws/lib/permessage-deflate.js MODULE 681033: Module._load REQUEST ./constants parent: /home/USER/Scripts/tizentube/TizenTube/node_modules/ws/lib/receiver.js MODULE 681033: Module._load REQUEST ./buffer-util parent: /home/USER/Scripts/tizentube/TizenTube/node_modules/ws/lib/receiver.js MODULE 681033: Module._load REQUEST ./validation parent: /home/USER/Scripts/tizentube/TizenTube/node_modules/ws/lib/receiver.js MODULE 681033: RELATIVE: requested: ./validation from parent.id /home/USER/Scripts/tizentube/TizenTube/node_modules/ws/lib/receiver.js MODULE 681033: looking for ["/home/USER/Scripts/tizentube/TizenTube/node_modules/ws/lib"] MODULE 681033: load "/home/USER/Scripts/tizentube/TizenTube/node_modules/ws/lib/validation.js" for module "/home/USER/Scripts/tizentube/TizenTube/node_modules/ws/lib/validation.js" MODULE 681033: Module._load REQUEST buffer parent: /home/USER/Scripts/tizentube/TizenTube/node_modules/ws/lib/validation.js MODULE 681033: load built-in module buffer MODULE 681033: looking for "/home/USER/Scripts/tizentube/TizenTube/node_modules/ws/lib/sender.js" in ["/home/USER/.node_modules","/home/USER/.node_libraries","/usr/lib/node"] MODULE 681033: load "/home/USER/Scripts/tizentube/TizenTube/node_modules/ws/lib/sender.js" for module "/home/USER/Scripts/tizentube/TizenTube/node_modules/ws/lib/sender.js" MODULE 681033: Module._load REQUEST net parent: /home/USER/Scripts/tizentube/TizenTube/node_modules/ws/lib/sender.js MODULE 681033: load built-in module net MODULE 681033: Module._load REQUEST tls parent: /home/USER/Scripts/tizentube/TizenTube/node_modules/ws/lib/sender.js MODULE 681033: load built-in module tls MODULE 681033: Module._load REQUEST crypto parent: /home/USER/Scripts/tizentube/TizenTube/node_modules/ws/lib/sender.js MODULE 681033: load built-in module crypto MODULE 681033: Module._load REQUEST ./permessage-deflate parent: /home/USER/Scripts/tizentube/TizenTube/node_modules/ws/lib/sender.js MODULE 681033: Module._load REQUEST ./constants parent: /home/USER/Scripts/tizentube/TizenTube/node_modules/ws/lib/sender.js MODULE 681033: Module._load REQUEST ./validation parent: /home/USER/Scripts/tizentube/TizenTube/node_modules/ws/lib/sender.js MODULE 681033: Module._load REQUEST ./buffer-util parent: /home/USER/Scripts/tizentube/TizenTube/node_modules/ws/lib/sender.js MODULE 681033: looking for "/home/USER/Scripts/tizentube/TizenTube/node_modules/ws/lib/websocket.js" in ["/home/USER/.node_modules","/home/USER/.node_libraries","/usr/lib/node"] MODULE 681033: load "/home/USER/Scripts/tizentube/TizenTube/node_modules/ws/lib/websocket.js" for module "/home/USER/Scripts/tizentube/TizenTube/node_modules/ws/lib/websocket.js" MODULE 681033: Module._load REQUEST events parent: /home/USER/Scripts/tizentube/TizenTube/node_modules/ws/lib/websocket.js MODULE 681033: load built-in module events MODULE 681033: Module._load REQUEST https parent: /home/USER/Scripts/tizentube/TizenTube/node_modules/ws/lib/websocket.js MODULE 681033: load built-in module https MODULE 681033: Module._load REQUEST http parent: /home/USER/Scripts/tizentube/TizenTube/node_modules/ws/lib/websocket.js MODULE 681033: load built-in module http MODULE 681033: Module._load REQUEST net parent: /home/USER/Scripts/tizentube/TizenTube/node_modules/ws/lib/websocket.js MODULE 681033: load built-in module net MODULE 681033: Module._load REQUEST tls parent: /home/USER/Scripts/tizentube/TizenTube/node_modules/ws/lib/websocket.js MODULE 681033: load built-in module tls MODULE 681033: Module._load REQUEST crypto parent: /home/USER/Scripts/tizentube/TizenTube/node_modules/ws/lib/websocket.js MODULE 681033: load built-in module crypto MODULE 681033: Module._load REQUEST stream parent: /home/USER/Scripts/tizentube/TizenTube/node_modules/ws/lib/websocket.js MODULE 681033: load built-in module stream MODULE 681033: Module._load REQUEST url parent: /home/USER/Scripts/tizentube/TizenTube/node_modules/ws/lib/websocket.js MODULE 681033: load built-in module url MODULE 681033: Module._load REQUEST ./permessage-deflate parent: /home/USER/Scripts/tizentube/TizenTube/node_modules/ws/lib/websocket.js MODULE 681033: Module._load REQUEST ./receiver parent: /home/USER/Scripts/tizentube/TizenTube/node_modules/ws/lib/websocket.js MODULE 681033: RELATIVE: requested: ./receiver from parent.id /home/USER/Scripts/tizentube/TizenTube/node_modules/ws/lib/websocket.js MODULE 681033: looking for ["/home/USER/Scripts/tizentube/TizenTube/node_modules/ws/lib"] MODULE 681033: Module._load REQUEST ./sender parent: /home/USER/Scripts/tizentube/TizenTube/node_modules/ws/lib/websocket.js MODULE 681033: RELATIVE: requested: ./sender from parent.id /home/USER/Scripts/tizentube/TizenTube/node_modules/ws/lib/websocket.js MODULE 681033: looking for ["/home/USER/Scripts/tizentube/TizenTube/node_modules/ws/lib"] MODULE 681033: Module._load REQUEST ./constants parent: /home/USER/Scripts/tizentube/TizenTube/node_modules/ws/lib/websocket.js MODULE 681033: Module._load REQUEST ./event-target parent: /home/USER/Scripts/tizentube/TizenTube/node_modules/ws/lib/websocket.js MODULE 681033: RELATIVE: requested: ./event-target from parent.id /home/USER/Scripts/tizentube/TizenTube/node_modules/ws/lib/websocket.js MODULE 681033: looking for ["/home/USER/Scripts/tizentube/TizenTube/node_modules/ws/lib"] MODULE 681033: load "/home/USER/Scripts/tizentube/TizenTube/node_modules/ws/lib/event-target.js" for module "/home/USER/Scripts/tizentube/TizenTube/node_modules/ws/lib/event-target.js" MODULE 681033: Module._load REQUEST ./constants parent: /home/USER/Scripts/tizentube/TizenTube/node_modules/ws/lib/event-target.js MODULE 681033: Module._load REQUEST ./extension parent: /home/USER/Scripts/tizentube/TizenTube/node_modules/ws/lib/websocket.js MODULE 681033: RELATIVE: requested: ./extension from parent.id /home/USER/Scripts/tizentube/TizenTube/node_modules/ws/lib/websocket.js MODULE 681033: looking for ["/home/USER/Scripts/tizentube/TizenTube/node_modules/ws/lib"] MODULE 681033: load "/home/USER/Scripts/tizentube/TizenTube/node_modules/ws/lib/extension.js" for module "/home/USER/Scripts/tizentube/TizenTube/node_modules/ws/lib/extension.js" MODULE 681033: Module._load REQUEST ./validation parent: /home/USER/Scripts/tizentube/TizenTube/node_modules/ws/lib/extension.js MODULE 681033: Module._load REQUEST ./buffer-util parent: /home/USER/Scripts/tizentube/TizenTube/node_modules/ws/lib/websocket.js MODULE 681033: looking for "/home/USER/Scripts/tizentube/TizenTube/node_modules/ws/lib/websocket-server.js" in ["/home/USER/.node_modules","/home/USER/.node_libraries","/usr/lib/node"] MODULE 681033: load "/home/USER/Scripts/tizentube/TizenTube/node_modules/ws/lib/websocket-server.js" for module "/home/USER/Scripts/tizentube/TizenTube/node_modules/ws/lib/websocket-server.js" MODULE 681033: Module._load REQUEST events parent: /home/USER/Scripts/tizentube/TizenTube/node_modules/ws/lib/websocket-server.js MODULE 681033: load built-in module events MODULE 681033: Module._load REQUEST http parent: /home/USER/Scripts/tizentube/TizenTube/node_modules/ws/lib/websocket-server.js MODULE 681033: load built-in module http MODULE 681033: Module._load REQUEST https parent: /home/USER/Scripts/tizentube/TizenTube/node_modules/ws/lib/websocket-server.js MODULE 681033: load built-in module https MODULE 681033: Module._load REQUEST net parent: /home/USER/Scripts/tizentube/TizenTube/node_modules/ws/lib/websocket-server.js MODULE 681033: load built-in module net MODULE 681033: Module._load REQUEST tls parent: /home/USER/Scripts/tizentube/TizenTube/node_modules/ws/lib/websocket-server.js MODULE 681033: load built-in module tls MODULE 681033: Module._load REQUEST crypto parent: /home/USER/Scripts/tizentube/TizenTube/node_modules/ws/lib/websocket-server.js MODULE 681033: load built-in module crypto MODULE 681033: Module._load REQUEST ./extension parent: /home/USER/Scripts/tizentube/TizenTube/node_modules/ws/lib/websocket-server.js MODULE 681033: Module._load REQUEST ./permessage-deflate parent: /home/USER/Scripts/tizentube/TizenTube/node_modules/ws/lib/websocket-server.js MODULE 681033: Module._load REQUEST ./subprotocol parent: /home/USER/Scripts/tizentube/TizenTube/node_modules/ws/lib/websocket-server.js MODULE 681033: RELATIVE: requested: ./subprotocol from parent.id /home/USER/Scripts/tizentube/TizenTube/node_modules/ws/lib/websocket-server.js MODULE 681033: looking for ["/home/USER/Scripts/tizentube/TizenTube/node_modules/ws/lib"] MODULE 681033: load "/home/USER/Scripts/tizentube/TizenTube/node_modules/ws/lib/subprotocol.js" for module "/home/USER/Scripts/tizentube/TizenTube/node_modules/ws/lib/subprotocol.js" MODULE 681033: Module._load REQUEST ./validation parent: /home/USER/Scripts/tizentube/TizenTube/node_modules/ws/lib/subprotocol.js MODULE 681033: Module._load REQUEST ./websocket parent: /home/USER/Scripts/tizentube/TizenTube/node_modules/ws/lib/websocket-server.js MODULE 681033: RELATIVE: requested: ./websocket from parent.id /home/USER/Scripts/tizentube/TizenTube/node_modules/ws/lib/websocket-server.js MODULE 681033: looking for ["/home/USER/Scripts/tizentube/TizenTube/node_modules/ws/lib"] MODULE 681033: Module._load REQUEST ./constants parent: /home/USER/Scripts/tizentube/TizenTube/node_modules/ws/lib/websocket-server.js MODULE 681033: looking for "/home/USER/Scripts/tizentube/TizenTube/node_modules/adbhost/index.js" in ["/home/USER/.node_modules","/home/USER/.node_libraries","/usr/lib/node"] MODULE 681033: load "/home/USER/Scripts/tizentube/TizenTube/node_modules/adbhost/index.js" for module "/home/USER/Scripts/tizentube/TizenTube/node_modules/adbhost/index.js" MODULE 681033: Module._load REQUEST ./lib/client.js parent: /home/USER/Scripts/tizentube/TizenTube/node_modules/adbhost/index.js MODULE 681033: RELATIVE: requested: ./lib/client.js from parent.id /home/USER/Scripts/tizentube/TizenTube/node_modules/adbhost/index.js MODULE 681033: looking for ["/home/USER/Scripts/tizentube/TizenTube/node_modules/adbhost"] MODULE 681033: load "/home/USER/Scripts/tizentube/TizenTube/node_modules/adbhost/lib/client.js" for module "/home/USER/Scripts/tizentube/TizenTube/node_modules/adbhost/lib/client.js" MODULE 681033: Module._load REQUEST util parent: /home/USER/Scripts/tizentube/TizenTube/node_modules/adbhost/lib/client.js MODULE 681033: load built-in module util MODULE 681033: Module._load REQUEST events parent: /home/USER/Scripts/tizentube/TizenTube/node_modules/adbhost/lib/client.js MODULE 681033: load built-in module events MODULE 681033: Module._load REQUEST net parent: /home/USER/Scripts/tizentube/TizenTube/node_modules/adbhost/lib/client.js MODULE 681033: load built-in module net MODULE 681033: Module._load REQUEST stream parent: /home/USER/Scripts/tizentube/TizenTube/node_modules/adbhost/lib/client.js MODULE 681033: load built-in module stream MODULE 681033: Module._load REQUEST ./stream.js parent: /home/USER/Scripts/tizentube/TizenTube/node_modules/adbhost/lib/client.js MODULE 681033: RELATIVE: requested: ./stream.js from parent.id /home/USER/Scripts/tizentube/TizenTube/node_modules/adbhost/lib/client.js MODULE 681033: looking for ["/home/USER/Scripts/tizentube/TizenTube/node_modules/adbhost/lib"] MODULE 681033: load "/home/USER/Scripts/tizentube/TizenTube/node_modules/adbhost/lib/stream.js" for module "/home/USER/Scripts/tizentube/TizenTube/node_modules/adbhost/lib/stream.js" MODULE 681033: Module._load REQUEST util parent: /home/USER/Scripts/tizentube/TizenTube/node_modules/adbhost/lib/stream.js MODULE 681033: load built-in module util MODULE 681033: Module._load REQUEST stream parent: /home/USER/Scripts/tizentube/TizenTube/node_modules/adbhost/lib/stream.js MODULE 681033: load built-in module stream MODULE 681033: Module._load REQUEST ./packet.js parent: /home/USER/Scripts/tizentube/TizenTube/node_modules/adbhost/lib/stream.js MODULE 681033: RELATIVE: requested: ./packet.js from parent.id /home/USER/Scripts/tizentube/TizenTube/node_modules/adbhost/lib/stream.js MODULE 681033: looking for ["/home/USER/Scripts/tizentube/TizenTube/node_modules/adbhost/lib"] MODULE 681033: load "/home/USER/Scripts/tizentube/TizenTube/node_modules/adbhost/lib/packet.js" for module "/home/USER/Scripts/tizentube/TizenTube/node_modules/adbhost/lib/packet.js" MODULE 681033: Module._load REQUEST ./packet parent: /home/USER/Scripts/tizentube/TizenTube/node_modules/adbhost/lib/client.js MODULE 681033: RELATIVE: requested: ./packet from parent.id /home/USER/Scripts/tizentube/TizenTube/node_modules/adbhost/lib/client.js MODULE 681033: looking for ["/home/USER/Scripts/tizentube/TizenTube/node_modules/adbhost/lib"] MODULE 681033: looking for "/home/USER/Scripts/tizentube/TizenTube/node_modules/fetch-blob/streams.cjs" in ["/home/USER/.node_modules","/home/USER/.node_libraries","/usr/lib/node"] MODULE 681033: load "/home/USER/Scripts/tizentube/TizenTube/node_modules/fetch-blob/streams.cjs" for module "/home/USER/Scripts/tizentube/TizenTube/node_modules/fetch-blob/streams.cjs" MODULE 681033: Module._load REQUEST buffer parent: /home/USER/Scripts/tizentube/TizenTube/node_modules/fetch-blob/streams.cjs MODULE 681033: load built-in module buffer MODULE 681033: looking for "/home/USER/Scripts/tizentube/TizenTube/node_modules/node-domexception/index.js" in ["/home/USER/.node_modules","/home/USER/.node_libraries","/usr/lib/node"] MODULE 681033: load "/home/USER/Scripts/tizentube/TizenTube/node_modules/node-domexception/index.js" for module "/home/USER/Scripts/tizentube/TizenTube/node_modules/node-domexception/index.js" NET 681033: createConnection [ { port: 26101, host: '10.0.0.187' }, null,

] NET 681033: pipe false undefined NET 681033: setupListenHandle null 3000 4 0 undefined NET 681033: setupListenHandle: create a handle NET 681033: bind to :: NET 681033: connect: attempting to connect to 10.0.0.187:26101 (addressType: 4) NET 681033: _read - n 16384 isConnecting? true hasHandle? true NET 681033: _read wait for connection NET 681033: afterConnect ADB connection established NET 681033: _read - n 16384 isConnecting? false hasHandle? true NET 681033: Socket._handle.readStart NET 681033: _read - n 16384 isConnecting? false hasHandle? true NET 681033: onconnection NET 681033: _read - n 16384 isConnecting? false hasHandle? true NET 681033: Socket._handle.readStart HTTP 681033: SERVER new http connection (node:681033) Warning: Setting the NODE_DEBUG environment variable to 'http' can expose sensitive data (such as passwords, tokens and authentication headers) in the resulting log. HTTP 681033: SERVER socketOnParserExecute 466 HTTP 681033: SERVER upgrade or connect GET HTTP 681033: SERVER have listener for upgrade NET 681033: _read - n 16384 isConnecting? false hasHandle? true NET 681033: _final: not ended, call shutdown() NET 681033: _read - n 16384 isConnecting? false hasHandle? true NET 681033: afterShutdown destroyed=false NET 681033: destroy NET 681033: close NET 681033: close handle NET 681033: has server NET 681033: SERVER _emitCloseIfDrained NET 681033: SERVER handle? true connections? 0 NET 681033: emit close NET 681033: _read - n 16384 isConnecting? false hasHandle? true NET 681033: _read - n 16384 isConnecting? false hasHandle? true NET 681033: _read - n 16384 isConnecting? false hasHandle? true HTTP 681033: call onSocket 0 0 HTTP 681033: createConnection 10.0.0.187:43777: [Object: null prototype] { protocol: 'http:', hostname: '10.0.0.187', hash: '', search: '', pathname: '/json', path: null, href: 'http://10.0.0.187:43777/json', port: 43777, method: 'GET', headers: { accept: '/', 'accept-encoding': 'gzip, deflate, br', connection: 'close', 'user-agent': 'node-fetch' }, insecureHTTPParser: false, agent: undefined, host: '10.0.0.187', keepAlive: true, scheduling: 'lifo', timeout: 5000, noDelay: true, servername: '', _agentKey: '10.0.0.187:43777:' } NET 681033: createConnection [ [Object: null prototype] { protocol: 'http:', hostname: '10.0.0.187', hash: '', search: '', pathname: '/json', path: null, href: 'http://10.0.0.187:43777/json', port: 43777, method: 'GET', headers: { accept: '/', 'accept-encoding': 'gzip, deflate, br', connection: 'close', 'user-agent': 'node-fetch' }, insecureHTTPParser: false, agent: undefined, host: '10.0.0.187', keepAlive: true, scheduling: 'lifo', timeout: 5000, noDelay: true, servername: '', _agentKey: '10.0.0.187:43777:', encoding: null, keepAliveInitialDelay: 1000 }, [Function (anonymous)],

] NET 681033: pipe false null HTTP 681033: sockets 10.0.0.187:43777: 1 1 HTTP 681033: outgoing message end. NET 681033: connect: attempting to connect to 10.0.0.187:43777 (addressType: 4) NET 681033: _read - n 16384 isConnecting? true hasHandle? true NET 681033: _read wait for connection NET 681033: afterConnect NET 681033: _read - n 16384 isConnecting? false hasHandle? true NET 681033: Socket._handle.readStart HTTP 681033: AGENT incoming response! NET 681033: _read - n 16384 isConnecting? false hasHandle? true HTTP 681033: AGENT socket keep-alive HTTP 681033: CLIENT socket onFree HTTP 681033: agent.on(free) 10.0.0.187:43777: HTTP 681033: removeSocket 10.0.0.187:43777: writable: true NET 681033: createConnection [ { protocolVersion: 13, maxPayload: 104857600, skipUTF8Validation: false, perMessageDeflate: true, followRedirects: false, maxRedirects: 10, createConnection: [Function: netConnect], socketPath: undefined, hostname: undefined, protocol: undefined, timeout: undefined, method: 'GET', host: '10.0.0.187', path: undefined, port: '43777', defaultPort: 80, headers: { 'Sec-WebSocket-Version': 13, 'Sec-WebSocket-Key': 'n6C9m4+7x1dWWyFaXJhXmg==', Connection: 'Upgrade', Upgrade: 'websocket', 'Sec-WebSocket-Extensions': 'permessage-deflate; client_max_window_bits' } }, null,

] NET 681033: pipe false undefined HTTP 681033: outgoing message end. NET 681033: connect: attempting to connect to 10.0.0.187:43777 (addressType: 4) NET 681033: _read - n 16384 isConnecting? true hasHandle? true NET 681033: _read wait for connection NET 681033: afterConnect NET 681033: _read - n 16384 isConnecting? false hasHandle? true NET 681033: Socket._handle.readStart HTTP 681033: AGENT incoming response! NET 681033: _read - n 16384 isConnecting? false hasHandle? true NET 681033: _read - n 16384 isConnecting? false hasHandle? true NET 681033: _read - n 16384 isConnecting? false hasHandle? true NET 681033: _read - n 16384 isConnecting? false hasHandle? true NET 681033: _read - n 16384 isConnecting? false hasHandle? true NET 681033: _read - n 16384 isConnecting? false hasHandle? true NET 681033: _read - n 16384 isConnecting? false hasHandle? true NET 681033: _read - n 16384 isConnecting? false hasHandle? true NET 681033: _read - n 16384 isConnecting? false hasHandle? true NET 681033: _read - n 16384 isConnecting? false hasHandle? true NET 681033: _read - n 16384 isConnecting? false hasHandle? true NET 681033: _read - n 16384 isConnecting? false hasHandle? true NET 681033: _read - n 16384 isConnecting? false hasHandle? true NET 681033: _read - n 16384 isConnecting? false hasHandle? true NET 681033: _final: not ended, call shutdown() NET 681033: afterShutdown destroyed=false NET 681033: destroy NET 681033: close NET 681033: close handle NET 681033: emit close NET 681033: _final: not ended, call shutdown() NET 681033: afterShutdown destroyed=false NET 681033: destroy NET 681033: close NET 681033: close handle NET 681033: emit close HTTP 681033: CLIENT socket onClose HTTP 681033: removeSocket 10.0.0.187:43777: writable: false NET 681033: onconnection NET 681033: _read - n 16384 isConnecting? false hasHandle? true NET 681033: Socket._handle.readStart HTTP 681033: SERVER new http connection HTTP 681033: SERVER socketOnParserExecute 466 HTTP 681033: SERVER upgrade or connect GET HTTP 681033: SERVER have listener for upgrade NET 681033: _read - n 16384 isConnecting? false hasHandle? true NET 681033: _final: not ended, call shutdown() NET 681033: _read - n 16384 isConnecting? false hasHandle? true NET 681033: afterShutdown destroyed=false NET 681033: destroy NET 681033: close NET 681033: close handle NET 681033: has server NET 681033: SERVER _emitCloseIfDrained NET 681033: SERVER handle? true connections? 0 NET 681033: emit close NET 681033: _read - n 16384 isConnecting? false hasHandle? true NET 681033: _read - n 16384 isConnecting? false hasHandle? true NET 681033: _read - n 16384 isConnecting? false hasHandle? true HTTP 681033: call onSocket 0 0 HTTP 681033: createConnection 10.0.0.187:44575: [Object: null prototype] { protocol: 'http:', hostname: '10.0.0.187', hash: '', search: '', pathname: '/json', path: null, href: 'http://10.0.0.187:44575/json', port: 44575, method: 'GET', headers: { accept: '/', 'accept-encoding': 'gzip, deflate, br', connection: 'close', 'user-agent': 'node-fetch' }, insecureHTTPParser: false, agent: undefined, host: '10.0.0.187', keepAlive: true, scheduling: 'lifo', timeout: 5000, noDelay: true, servername: '', _agentKey: '10.0.0.187:44575:' } NET 681033: createConnection [ [Object: null prototype] { protocol: 'http:', hostname: '10.0.0.187', hash: '', search: '', pathname: '/json', path: null, href: 'http://10.0.0.187:44575/json', port: 44575, method: 'GET', headers: { accept: '/', 'accept-encoding': 'gzip, deflate, br', connection: 'close', 'user-agent': 'node-fetch' }, insecureHTTPParser: false, agent: undefined, host: '10.0.0.187', keepAlive: true, scheduling: 'lifo', timeout: 5000, noDelay: true, servername: '', _agentKey: '10.0.0.187:44575:', encoding: null, keepAliveInitialDelay: 1000 }, [Function (anonymous)],

] NET 681033: pipe false null HTTP 681033: sockets 10.0.0.187:44575: 1 1 HTTP 681033: outgoing message end. NET 681033: connect: attempting to connect to 10.0.0.187:44575 (addressType: 4) NET 681033: _read - n 16384 isConnecting? true hasHandle? true NET 681033: _read wait for connection NET 681033: afterConnect NET 681033: _read - n 16384 isConnecting? false hasHandle? true NET 681033: Socket._handle.readStart HTTP 681033: AGENT incoming response! NET 681033: _read - n 16384 isConnecting? false hasHandle? true HTTP 681033: AGENT socket keep-alive HTTP 681033: CLIENT socket onFree HTTP 681033: agent.on(free) 10.0.0.187:44575: HTTP 681033: removeSocket 10.0.0.187:44575: writable: true NET 681033: createConnection [ { protocolVersion: 13, maxPayload: 104857600, skipUTF8Validation: false, perMessageDeflate: true, followRedirects: false, maxRedirects: 10, createConnection: [Function: netConnect], socketPath: undefined, hostname: undefined, protocol: undefined, timeout: undefined, method: 'GET', host: '10.0.0.187', path: undefined, port: '44575', defaultPort: 80, headers: { 'Sec-WebSocket-Version': 13, 'Sec-WebSocket-Key': 'UvWlnr56Fd+xfYpGyl6tdg==', Connection: 'Upgrade', Upgrade: 'websocket', 'Sec-WebSocket-Extensions': 'permessage-deflate; client_max_window_bits' } }, null,

] NET 681033: pipe false undefined HTTP 681033: outgoing message end. NET 681033: connect: attempting to connect to 10.0.0.187:44575 (addressType: 4) NET 681033: _read - n 16384 isConnecting? true hasHandle? true NET 681033: _read wait for connection NET 681033: afterConnect NET 681033: _read - n 16384 isConnecting? false hasHandle? true NET 681033: Socket._handle.readStart HTTP 681033: AGENT incoming response! NET 681033: _read - n 16384 isConnecting? false hasHandle? true NET 681033: _read - n 16384 isConnecting? false hasHandle? true NET 681033: _read - n 16384 isConnecting? false hasHandle? true NET 681033: _read - n 16384 isConnecting? false hasHandle? true NET 681033: _read - n 16384 isConnecting? false hasHandle? true NET 681033: _read - n 16384 isConnecting? false hasHandle? true NET 681033: _read - n 16384 isConnecting? false hasHandle? true NET 681033: _read - n 16384 isConnecting? false hasHandle? true NET 681033: _read - n 16384 isConnecting? false hasHandle? true NET 681033: _read - n 16384 isConnecting? false hasHandle? true NET 681033: _read - n 16384 isConnecting? false hasHandle? true NET 681033: _read - n 16384 isConnecting? false hasHandle? true NET 681033: _read - n 16384 isConnecting? false hasHandle? true NET 681033: _read - n 16384 isConnecting? false hasHandle? true NET 681033: _read - n 16384 isConnecting? false hasHandle? true NET 681033: _onTimeout HTTP 681033: CLIENT socket onTimeout NET 681033: destroy NET 681033: close NET 681033: close handle NET 681033: emit close HTTP 681033: CLIENT socket onClose HTTP 681033: removeSocket 10.0.0.187:44575: writable: false NET 681033: _read - n 16384 isConnecting? false hasHandle? true NET 681033: _read - n 16384 isConnecting? false hasHandle? true NET 681033: _read - n 16384 isConnecting? false hasHandle? true NET 681033: _read - n 16384 isConnecting? false hasHandle? true NET 681033: _read - n 16384 isConnecting? false hasHandle? true NET 681033: _read - n 16384 isConnecting? false hasHandle? true NET 681033: _read - n 16384 isConnecting? false hasHandle? true NET 681033: _read - n 16384 isConnecting? false hasHandle? true NET 681033: _read - n 16384 isConnecting? false hasHandle? true NET 681033: _read - n 16384 isConnecting? false hasHandle? true NET 681033: _read - n 16384 isConnecting? false hasHandle? true NET 681033: _read - n 16384 isConnecting? false hasHandle? true NET 681033: _read - n 16384 isConnecting? false hasHandle? true NET 681033: _read - n 16384 isConnecting? false hasHandle? true NET 681033: _read - n 16384 isConnecting? false hasHandle? true NET 681033: _read - n 16384 isConnecting? false hasHandle? true NET 681033: _read - n 16384 isConnecting? false hasHandle? true NET 681033: _read - n 16384 isConnecting? false hasHandle? true NET 681033: _read - n 16384 isConnecting? false hasHandle? true NET 681033: _read - n 16384 isConnecting? false hasHandle? true NET 681033: _read - n 16384 isConnecting? false hasHandle? true NET 681033: _read - n 16384 isConnecting? false hasHandle? true NET 681033: _read - n 16384 isConnecting? false hasHandle? true NET 681033: _read - n 16384 isConnecting? false hasHandle? true NET 681033: _read - n 16384 isConnecting? false hasHandle? true NET 681033: _read - n 16384 isConnecting? false hasHandle? true NET 681033: _read - n 16384 isConnecting? false hasHandle? true NET 681033: _read - n 16384 isConnecting? false hasHandle? true NET 681033: _read - n 16384 isConnecting? false hasHandle? true NET 681033: _read - n 16384 isConnecting? false hasHandle? true NET 681033: _read - n 16384 isConnecting? false hasHandle? true NET 681033: _read - n 16384 isConnecting? false hasHandle? true NET 681033: _read - n 16384 isConnecting? false hasHandle? true NET 681033: _read - n 16384 isConnecting? false hasHandle? true NET 681033: _read - n 16384 isConnecting? false hasHandle? true NET 681033: _read - n 16384 isConnecting? false hasHandle? true NET 681033: _read - n 16384 isConnecting? false hasHandle? true NET 681033: _read - n 16384 isConnecting? false hasHandle? true NET 681033: _read - n 16384 isConnecting? false hasHandle? true NET 681033: _read - n 16384 isConnecting? false hasHandle? true NET 681033: _read - n 16384 isConnecting? false hasHandle? true NET 681033: _read - n 16384 isConnecting? false hasHandle? true NET 681033: _read - n 16384 isConnecting? false hasHandle? true NET 681033: _read - n 16384 isConnecting? false hasHandle? true NET 681033: _read - n 16384 isConnecting? false hasHandle? true NET 681033: _read - n 16384 isConnecting? false hasHandle? true NET 681033: _read - n 16384 isConnecting? false hasHandle? true NET 681033: _read - n 16384 isConnecting? false hasHandle? true NET 681033: _read - n 16384 isConnecting? false hasHandle? true NET 681033: _read - n 16384 isConnecting? false hasHandle? true NET 681033: _read - n 16384 isConnecting? false hasHandle? true NET 681033: _read - n 16384 isConnecting? false hasHandle? true NET 681033: _read - n 16384 isConnecting? false hasHandle? true NET 681033: _read - n 16384 isConnecting? false hasHandle? true NET 681033: _read - n 16384 isConnecting? false hasHandle? true NET 681033: _read - n 16384 isConnecting? false hasHandle? true NET 681033: _read - n 16384 isConnecting? false hasHandle? true NET 681033: _read - n 16384 isConnecting? false hasHandle? true NET 681033: _read - n 16384 isConnecting? false hasHandle? true NET 681033: _read - n 16384 isConnecting? false hasHandle? true NET 681033: _read - n 16384 isConnecting? false hasHandle? true NET 681033: _read - n 16384 isConnecting? false hasHandle? true NET 681033: _read - n 16384 isConnecting? false hasHandle? true NET 681033: _read - n 16384 isConnecting? false hasHandle? true NET 681033: _read - n 16384 isConnecting? false hasHandle? true NET 681033: _read - n 16384 isConnecting? false hasHandle? true NET 681033: _read - n 16384 isConnecting? false hasHandle? true NET 681033: _read - n 16384 isConnecting? false hasHandle? true NET 681033: _read - n 16384 isConnecting? false hasHandle? true ^Z [3]+ Stopped NODE_DEBUG=cluster,net,http,fs,tls,module,timers node .`

tizenserver.log

thmsdelange commented 9 months ago

I am having the same issue. It seems like the connection cannot be reestablished after the TV is rebooted

funkyfunked commented 9 months ago

I tested further - I don't think it's a problem on my end.

Reinstalled and changed everything server related to my NAS running debian. Same problem, exactly the same behaviour of reconnection error after reboot/power cycle. MAybe important to know - it does only happen if the TV is really powered off. If I press the power button for 2 sec so that the bootup screen is shown, it doesn't reconnect to the server 100% of attempts.

If I just let the TV sleep for 1 min (short press of power button), it may still work, but not always.

Here is some more info:

TV Tizen OS 7 (Samsung S90C)

Server: Debian 11.7 Node.js v21.5.0

Debug output of the server (see my comment in the last lines):

root@nas:/opt/tizenserver/TizenTube# node . (node:2955452) ExperimentalWarning: Importing JSON modules is an experimental feature and might change at any time (Use node --trace-warnings ... to show where the warning was created) ADB connection established Config read failed: SyntaxError: Unexpected token u in JSON at position 0 undefined Key event: keydown 40 40 false undefined Key event: keyup 40 40 false undefined Key event: keydown 38 38 false undefined Key event: keyup 38 38 false undefined Adding notification container undefined Key event: keydown 404 404 false undefined Taking over! undefined Showing and focusing! undefined uiContainer focused! undefined Key event: keyup 404 404 false undefined Taking over! undefined Key event: keydown 27 27 false undefined uiContainer key event: keydown 27 undefined uiContainer blured! undefined Key event: keyup 27 27 false undefined Key event: keydown 406 406 false undefined Taking over! undefined Showing and focusing! undefined speedUIContainer focused! undefined Key event: keyup 406 406 false undefined Taking over! undefined Key event: keydown 27 27 false undefined speedUIContainer key event: keydown 27 undefined speedUIContainer blured! undefined Key event: keyup 27 27 false undefined Key event: keydown 39 39 false undefined Key event: keyup 39 39 false undefined Key event: keydown 37 37 false undefined Key event: keyup 37 37 false undefined Key event: keydown 40 40 false undefined Key event: keyup 40 40 false undefined Key event: keydown 38 38 false undefined Key event: keyup 38 38 false undefined Key event: keydown 13 13 false undefined Key event: keyup 13 13 false undefined hashchange RV1HKodAvo0&list=RDCMUCQvTDmHza8erxZqDkjQ4bQQ null null true undefined RV1HKodAvo0&list=RDCMUCQvTDmHza8erxZqDkjQ4bQQ Got it: undefined undefined RV1HKodAvo0&list=RDCMUCQvTDmHza8erxZqDkjQ4bQQ No segments found. undefined Key event: keydown 13 13 false undefined Key event: keyup 13 13 false undefined Key event: keydown 27 27 false undefined Key event: keyup 27 27 false undefined Key event: keydown 27 27 false undefined Key event: keyup 27 27 false undefined hashchange [object Object] RV1HKodAvo0&list=RDCMUCQvTDmHza8erxZqDkjQ4bQQ undefined Key event: keydown 27 27 false undefined Key event: keyup 27 27 false undefined Key event: keydown 27 27 false undefined Key event: keyup 27 27 false undefined Key event: keydown 40 40 false undefined Key event: keyup 40 40 false undefined Key event: keydown 13 13 false undefined Key event: keyup 13 13 false undefined Config read failed: SyntaxError: Unexpected token u in JSON at position 0 undefined Key event: keydown 40 40 false undefined Key event: keyup 40 40 false undefined Key event: keydown 13 13 false undefined Key event: keyup 13 13 false undefined ADB connection closed, reconnecting... <---------- COMMENT: Right here the TV is restarted, then it doesn't work anymore ADB connection established

ExSign commented 9 months ago

I see something like that happening as well, but this happens on a single connection try. It connects, disconnects and directly reconnects in a single Launcher start. Afterwards the Launcher does not do anything (loading circle is turning for 2-3 secs and then nothing, I see the home screen of the TV again.) As also reported in https://github.com/reisxd/TizenTube/issues/29#issuecomment-1874144027

ADB connection established ADB connection closed, reconnecting... ADB connection established

My assumption is that the "ADB connection closed, reconnecting..." is leading to the same issue as when the TV would turn off.

Using the same TV Model: Tizen OS 7 (Samsung S90C)

MrCasibot commented 8 months ago

Same problem here (it works but when tv is restarted, launcher doesn't do anything and it returns to the main menu).

I am using pm2 but I was curious on how guys do you keep the script (index.js) running ?

Also, it would be interesting to know what is the OS / configuration of each, especially those who have no issues. I am running the script on my Rasperry Pi 3B+ running on raspbian and connected to network via wifi.

TV is on Tizen OS 5 (Samsung UE50RU) (tbc)

funkyfunked commented 8 months ago

Same problem here (it works but when tv is restarted, launcher doesn't do anything and it returns to the main menu).

I am using pm2 but I was curious on how guys do you keep the script (index.js) running ?

Also, it would be interesting to know what is the OS / configuration of each, especially those who have no issues. I am running the script on my Rasperry Pi 3B+ running on raspbian and connected to network via wifi.

TV is on Tizen OS 5 (Samsung UE50RU) (tbc)

There is a problem with the adb (re-)connection to the server in the latest release. I switched to an older commit that uses sdb instead of adb. Everything works for me now with this release:

https://github.com/reisxd/TizenTube/tree/5a01cb03abe69e3ed7983d6fdb34cdd898575777

Sometimes the launcher closes after the first launch on the TV, but the second time it always works for me. I also set the server up with pm2 to automatically restart the server in case of a crash.

You can read up on it on discord, thanks to the suggestion of SomeOne who found the solution.

You can also only partially revert to this commit to keep the latest updates (play/pause button on remote working for example).

Have fun :)

ThowZzy commented 8 months ago

Hello @funkyfunked, do you want to test my attempt ? Launch first try even after reboot index.js

import { WebSocketServer } from 'ws';
import adbhost from 'adbhost';
import startDebugging from './debuggerController.js';
import Config from './config.json' assert { type: 'json' };

var adb_exists=false;
var executed_launcher=false;
var mute_logs=false;
var multiple_fail=0;
var adb;

AdbConnection();

function AdbConnection() {
    if(adb_exists){
        // Close the existing connection before reconnecting
        adb._stream.end();

        // Remove previous event handlers before attaching new ones
        adb._stream.removeAllListeners('error');
        adb._stream.removeAllListeners('connect');
    }

    // Attempt to create a new ADB connection
    createAdbConnection();
}

function createAdbConnection() {    
    //Create connection
    adb = adbhost.createConnection({ host: Config.tvIP, port: 26101 });

    //Handler for successful connection
    adb._stream.on('connect', () => {
        console.log('ADB connection established');
        multiple_fail=0;
        mute_logs=false;
        // Re-Launch the app, otherwise we would need to start the launcher manually again (needs testing but seems fine)
        // Do that only if it was a reconnect and that the launcher was previously launched
        if(adb_exists && executed_launcher){
            const shellCmd = adb.createStream(`shell:0 debug ${Config.appId}${Config.isTizen3 ? ' 0' : ''}`);
            shellCmd.on('data', data => {
                const dataString = data.toString();
                if (dataString.includes('debug')) {
                    const port = dataString.substr(dataString.indexOf(':') + 1, 6).replace(' ', '');
                    startDebugging(port);
                }
            });
        }
    });

    // Handler for error of connection (with recursivity for reconnecting)
    adb._stream.on('error', () => {
        if(!mute_logs){ //Mute logs if too many retries
            console.log('ADB connection closed, reconnecting...');
            multiple_fail++;
            if(multiple_fail>5){
                mute_logs=true;
                console.log('Continuing retries silently...');
            }
        }
        AdbConnection(); //Retry connection
    });

    adb_exists=true;
}

const wss = new WebSocketServer({ port: 3000 });
wss.on('connection', ws => {
    ws.on('message', message => {
        let msg;
        try {
            msg = JSON.parse(message.toString());
        } catch {
            ws.send(JSON.stringify({
                error: 'Invalid data'
            }));
            return;
        }
        switch (msg.e) {
            case 'launch': {
                ws.send(JSON.stringify({
                    ok: true
                }));
                executed_launcher=true;
                // Launch the app
                const shellCmd = adb.createStream(`shell:0 debug ${Config.appId}${Config.isTizen3 ? ' 0' : ''}`);
                shellCmd.on('data', data => {
                    const dataString = data.toString();
                    if (dataString.includes('debug')) {
                        const port = dataString.substr(dataString.indexOf(':') + 1, 6).replace(' ', '');
                        startDebugging(port);
                    }
                });
                break;
            }
            default: {
                ws.send(JSON.stringify({
                    error: 'Unknown event'
                }));
                break;
            }
        }
    });
});

// If the server is running on Android and the CWD is /, change it (required for the Android app)
if (process.cwd() === '/' && process.platform === 'android') {
    process.chdir('/data/user/0/io.gh.reisxd.tizentube/files/tizentube');
}
funkyfunked commented 8 months ago

Works like a charm for me now, even after TV reboot. Thank you very much @ThowZzy!

Maybe open a PR with this code if it works for everyone?

ThowZzy commented 8 months ago

Yeah I might, im already submitting these on discord to reis for his opinion.

I wrote another approach if you want, its a bit cleaner. (this time I edited also the debugger file)

Edit : It is merged to main