Toxblh / samsung-tv-control

📺 Remote control your TV via JS!
https://toxblh.github.io/samsung-tv-control/
MIT License
177 stars 34 forks source link

sendKeyPromise() causes application to never exit #277

Open matt328 opened 2 years ago

matt328 commented 2 years ago

Possibly I don't have my application configured correctly, but if I call control.sendKeyPromise(), the application never exits. Not sure if it keeps a websocket alive and node is detecting this or what, but the promise resolves and execution passes through the entirety of index.ts, just the process never exits.

Edit:

https://github.com/matt328/game-time/blob/main/src/index.ts#L28 is my repro.

hurrikam commented 2 years ago

I came to see if this issue was already reported. I'm using the latest version 1.12.4 and I think the conditional logic in the internal _sendKey() function isn't closing the WebSocket connection in every case it should. By the way it happens with the callback based version as well, sendKey().

I tried calling the closeConnection method in the callback or after the promise is resolved but as far I can see, the method is empty and it does nothing.

eisenwinter commented 1 year ago

yeah its an open handle issue, it keeps the connection open for some reason

and also Ive been wondering why I couldnt close it till i peeked at https://github.com/Toxblh/samsung-tv-control/blob/master/src/samsung.ts#L348