Skip to main content

Create client

ADB Server has its own sets of commands. AdbServerClient class is a TypeScript re-implementation of Google ADB Client, that provides a high-level API to interact with the Server.

Create connector

AdbServerClient class needs to connect to the ADB Server using TCP sockets. To support different runtime environments, AdbServerClient uses an AdbServerConnector implementation to create those TCP sockets.

Direct Socket API is a new Web API that provides TCP and UDP sockets. The TCPSocket class from this API can be used to create a TCP connection to ADB Servers.

However, as of July 2024, it's still not clear how Direct Socket API will be implemented.

The current proposal requires the Web app to be bundled and signed by the developer, then manually installed by users. This is not a practical solution for general Web apps.

Create client

With a server connector, we can create a client:

import { AdbServerClient } from "@yume-chan/adb";

const client: AdbServerClient = new AdbServerClient(connector);

This step doesn't send or receive any packets, it only initializes some internal states.