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

Feature request: Add the HTTP protocol #6

Open
WeihuaGu opened this issue Jan 25, 2025 · 5 comments
Open

Feature request: Add the HTTP protocol #6

WeihuaGu opened this issue Jan 25, 2025 · 5 comments

Comments

@WeihuaGu
Copy link

Since what is sent is JSON, it's easy to send the JSON to the specified path.

@WeihuaGu WeihuaGu changed the title Add the HTTP protocol Feature request: Add the HTTP protocol Jan 25, 2025
@umer0586
Copy link
Owner

Hi, thanks for the suggestion!

HTTP is more of a request-response protocol, where every request expects a response. For DroidPad, that doesn't really fit the use case, since each interaction on the control pad would have to wait for a response. That could make things laggy and less smooth for real-time controls.

@imsamuka
Copy link

I never worked with WebSockets, but according to the wikipedia they are very compatible HTTP, so potentially you can already make a web server that goes through port 80 and 443, and acts pretty much exactly like a HTTP server. 🤔

@WeihuaGu
Copy link
Author

HTTP/2 introduced connection multiplexing, so it can reuse TCP connections. It depends on the server that can only returns the simplest 204 status code.
Indeed, when it is applied to key interactions similar to those of a gamepad, the request - response process may seem to cause a delay. However, if it is not used for such highly rapid interactions, like those implemented by a remote control, this delay is acceptable.

@umer0586
Copy link
Owner

umer0586 commented Jan 26, 2025

WebSocket is perfect for real-time stuff since it’s full-duplex and keeps everything flowing over a single TCP connection. Unlike HTTP, it’s not stuck in that request/response cycle. For something like a button press, waiting for a response is fine, but not when you’re dealing with sliders or joysticks. I might try to add HTTP support for simpler use cases but not 100% sure yet.

@WeihuaGu
Copy link
Author

There might be another suggestion. That is to include the timestamp in the sent JSON. This way, it will be possible to compare the sequence of key presses.

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

3 participants