---
title: "Transports"
category: how-to
---

# Transports

The Device Management Kit is offering several transports to communicate with a Ledger device.
Depending on the environment and usecase, you can choose the transport that best suits your needs.

## Available transports

| Transport                                                                               | Description                                                                                                   |
| --------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------- |
| [Web HID](https://www.npmjs.com/package/@ledgerhq/device-transport-kit-web-hid)         | The WebHID transport uses the Web HID API (usb) to communicate with a Ledger device.                          |
| [Web BLE](https://www.npmjs.com/package/@ledgerhq/device-transport-kit-web-ble)         | The WebBLE transport uses the Web BLE API (bluetooth) to communicate with a Ledger device.                    |
| [RN HID](https://www.npmjs.com/package/@ledgerhq/device-transport-kit-react-native-hid) | The React Native HID transport uses the react-native (usb) to communicate with a Ledger device.               |
| [RN BLE](https://www.npmjs.com/package/@ledgerhq/device-transport-kit-react-native-ble) | The React Native BLE transport uses the react-native-ble-plx (bluetooth) to communicate with a Ledger device. |
| [Node HID](https://www.npmjs.com/package/@ledgerhq/device-transport-kit-node-hid)       | The Node HID transport uses the node-hid library (usb) to communicate with a Ledger device.                   |
| [Speculos](https://www.npmjs.com/package/@ledgerhq/device-transport-kit-speculos)       | The Speculos transport is used to communicate with the speculos device simulator.                             |

## How to use a transport

Transports are injected in the DeviceManagementKitBuilder before building the Device Management Kit instance.
This is done by calling the `addTransport` method on the builder.
You can inject the transport in two different ways:

- Using the default transport factory provided by the package
- Using directly the transport creating your own factory (for custom transports or additional configuration...)

```typescript
import { DeviceManagementKitBuilder } from "@ledgerhq/device-management-kit";
import { WebHidTransport, webHidTransportFactory } from "@ledgerhq/device-transport-kit-web-hid";

// Using the default transport factory
const dmk = new DeviceManagementKitBuilder()
  .addTransport(webHidTransportFactory)
  .build();

// Using the transport directly
const dmk = new DeviceManagementKitBuilder()
  .addTransport(({
    deviceModelDataSource: DeviceModelDataSource;
    loggerServiceFactory: (tag: string) => LoggerPublisherService;
    config: DmkConfig;
    apduSenderServiceFactory: ApduSenderServiceFactory;
    apduReceiverServiceFactory: ApduReceiverServiceFactory;
  }) => {
    // Some extra code here to configure the transport
    // Then we return the transport instance
    return new WebHidTransport(
      deviceModelDataSource,
      loggerServiceFactory,
      config,
      apduSenderServiceFactory,
      apduReceiverServiceFactory,
    );
  })
  .build();
```

## How to use the Speculos transport

The Speculos transport is used to communicate with the speculos device simulator.
The factory function accepts a `speculosUrl` parameter that is the url of the speculos server.

```typescript
const dmk = new DeviceManagementKitBuilder()
  .addTransport(speculosTransportFactory("http://localhost:5000"))
  .build();
```
