ws-scrcpy
ws-scrcpy copied to clipboard
[Feature Request] Can we get device list from API instead of websocket?
Hi. What for? The main reason for receiving device list via WebSocket is that the list is automatically updated by the server then you connect/remove devices.
it will make easier to integrate to another app / service.
@drauggres hi, i found that this issue #89 and pr #91 should fixed this issue. however, i am getting error: can not get xxx for "http://127.0.0.1:8000/droid-device-list". and websocket error: Unsupported request for "ws://127.0.0.1:8000/?action=goog-device-list". did i miss anything here?
my ws-scrcpy version is: "version": "0.8.0-dev"
Hi @eaphone
As you can guess by the -dev
suffix this version is under development (sadly not really very active). This request doesn't work anymore. I've changed the API: now all websocket-request to the server use the same single connection instead of a separate one.
There is no simple way to switch it back without changing the code.
If you ready to do this, you will need to add this method to src/app/googDevice/client/DeviceTracker.ts
:
protected supportMultiplexing(): boolean {
return false;
}
and change this in src/server/index.ts
:
if (config.getRunLocalGoogTracker()) {
mwList.push(DeviceTracker); // was mw2List
}
After that this request should work: ws://HOST:8000/?action=goog-device-list
.
I don't remember http://127.0.0.1:8000/droid-device-list
ever working. But since now this project uses express it should be easy to add this route, see src/server/services/HttpServer.ts
@drauggres hi, thx for your reply.
changing the code did work prefectly!