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] Can we get device list from API instead of websocket? #153

Open
mhaqqiw opened this issue Oct 21, 2021 · 5 comments
Open

Comments

@mhaqqiw
Copy link

mhaqqiw commented Oct 21, 2021

No description provided.

@drauggres
Copy link
Collaborator

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.

@mhaqqiw
Copy link
Author

mhaqqiw commented Oct 25, 2021

it will make easier to integrate to another app / service.

@eaphone
Copy link

eaphone commented Feb 18, 2022

@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"

@drauggres
Copy link
Collaborator

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

@eaphone
Copy link

eaphone commented Feb 19, 2022

@drauggres hi, thx for your reply.

changing the code did work prefectly!

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