Rudis1261 / blink-server

This is the server you would need to be able to run the Blink Android Application.
MIT License
34 stars 7 forks source link

Two quick commands after each other break #9

Open Cxarli opened 5 years ago

Cxarli commented 5 years ago

For example, tapping twice quickly after another gives clickclick command not found, Eish. I think it's because the client_sock.recv(1024) receives too much at once.

Another case would be {"action":"mouse-move","x":1.811187744140625,"y":1.63995361328125}{"action":"mouse-move","x":2.9740753173828125,"y":0.71514892578125} command not found, Eish

Other than that, this works great! Thank you for making an open-source "It just works" equivalent. Other apps either didn't work, required WiFi, or were paid, so I appreciate this project :smile:

Rudis1261 commented 5 years ago

Hi Charlie,

Great to hear you get some use out of it. Unfortunately, I am not using this myself and linux primarily at the moment. I will have to see where I can work on this again to make a revised, better tested version. I believe it was meant to debounce too fast commands. I will try and give it a glance, but I can't promise anything.

Kind Regards, Rudi

On 2019-09-08 20:40, Charlie Bouthoorn wrote:

For example, tapping twice quickly after another gives clickclick command not found, Eish. I think it's because the client_sock.recv(1024) receives too much at once.

Another case would be {"action":"mouse-move","x":1.811187744140625,"y":1.63995361328125}{"action":"mouse-move","x":2.9740753173828125,"y":0.71514892578125} command not found, Eish

Other than that, this works great! Thank you for making an open-source "It just works" equivalent. Other apps either didn't work, required WiFi, or were paid, so I appreciate this project 😄

-- You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub [1], or mute the thread [2].

Links:

[1] https://github.com/drpain/blink-server/issues/9?email_source=notifications&email_token=AAOQPNXFOOLZ2TXPKXIEFSLQIVBJXA5CNFSM4IUUMIT2YY3PNVWWK3TUL52HS4DFUVEXG43VMWVGG33NNVSW45C7NFSM4HKA2V6Q [2] https://github.com/notifications/unsubscribe-auth/AAOQPNVFOKEL34IEEEZAUPLQIVBJXANCNFSM4IUUMITQ

Rudis1261 commented 5 years ago

@C-Bouthoorn Please pull the latest version of the server. I have added some code to try and curb the multiple commands coming through.

You may need to do this to get it to work:

sudo rm -rf core core.pyc #deletes possibly compiled version
git pull origin master
sudo ./bluetooth_server.py

This seems to make the mouse movement a bit smoother since it doesn't "drop" commands due to invalid JSON. Just a note on client_sock.recv(1024) you mentioned, what that means is that it will read up to 1024 bytes per request (1kb). Using something like this https://mothereff.in/byte-counter, you can see how much string content it could parse with 1kb of data.

This is quite fine, since most of these command as tiny. The issue is actually on the phone app, it's sending multiple commands in one string.

This fix should hopefully make it a bit better experience.

Cxarli commented 5 years ago

It seems to fix the case where two movements follow each other, but the following is still broken:

{"action":"mouse-move","x":0,"y":0}click command not found, or is missing in core