Skip to content

Communication protocols

Depending on the type of Tap you have, the available protocols are:

In case of using a relay (gateway), for example Tap Manager app in relay mode, additional communication protocols are available:

Provided implementation

Bluetooth Low Energy (BLE)

Connect to bluetooth device with mac address C3:23:DE:AA:BB:CC

// For Cordova environment
import { BLEComProtocol } from '@iotize/cordova-plugin-iotize-ble';
await this.tap.connect(new BLEComProtocol(AddressOrUUID));

// For node environment
import { NobleBLEAdapter, NobleBleScanner } from "@iotize/device-com-ble.node";


let bleScanner = new NobleBleScanner();
let peripheral: noble.Peripheral = await bleScanner.getDeviceByAddress(DEVICE_ADDRESS);
let bleProtocol = new NobleBLEAdapter(peripheral);

// From a bluetooth address
ComProtocol bleProtocol = BLEProtocol.fromAddress(context, "C3:23:DE:AA:BB:CC");

// If you already have an Android BluetoothDevice instance use this method:
BluetoothDevice bluetoothDevice = // ...
ComProtocol bleProtocol = BLEProtocol.fromDevice(context, bluetoothDevice);

Please refer to javadoc of BLEProtocol and to Cordova Documentation.


Please note that NFC Communication is only available for Android environment.


// Suppose you have an NFC tag
android.nfc.Tag tag = // ...

// Instantiate the NFC protocol from this tag
ComProtocol nfcProtocol = NFCProtocol.create(tag);

See javadoc for Android of NFCProtocol


For Wi-Fi communication, if you the program is connected to the same network as your Tap, you can use this method to instantiate your communication object:

// With node environment, use sockets
import { SocketProtocol } from '@iotize/device-com-socket.node';
let protocol = new SocketProtocol({
  host: 'localhost',
  port: 2000,

// With browser environment, use web sockets
import { WebSocketProtocol } from '@iotize/device-com-websocket.js';
let protocol = new WebSocketProtocol({
  url: 'tcp://localhost:2000',

// Socket protocol
ComProtocol socketProtocol = new SocketProtocol(new InetSocketAddress("<YOUR_IP_ADDRESS>", <PORT>));

// Wi-Fi protocol (for Tap with Wi-Fi capability)
// If we are already connected to the same network as the Tap:
ComProtocol wifiProtocol = WIFIProtocol.fromIP(context, "");

// To connect on a specific network, use WifiConfiguration wifiConfig;
// If you have an open network
wifiConfig = WIFIProtocol.createConfiguration("networkssid", WIFIProtocol.SecurityType.OPEN);
// Network with WPA key
wifiConfig = WIFIProtocol.createConfiguration("networkssid", WIFIProtocol.SecurityType.WPA, "wifipassord");
// Network with WEP key
wifiConfig = WIFIProtocol.createConfiguration("networkssid", WIFIProtocol.SecurityType.WEP, "wifipassord");

// Create the protocol with a specific network configuration
wifiProtocol = WIFIProtocol.fromIP(context, "", wifiConfig);

See javadoc for Android of WIFIProtocol


import { MqttProtocol } from '@iotize/device-com-mqtt.js';
let protocol = new MqttProtocol();

IoTizeMQTTClient mqttClient = new IoTizeMQTTClient("tcp://<yourbrokerurl>:<port>", "ClientId1", "/your/publish/topic");
MQTTProtocol protocol = new MQTTProtocol(mqttClient);

// Configure your protocol
    .subscribeToTopics(new String[]{

Custom protocols

With implementing the ComProtocol interface (See javadoc for Android of ComProtocol), you can build your own version ofTap communication and a seamless integration with the rest of IoTize Libraries.

import { ComProtocol } from '@iotize/device-client/protocol/api';

// Implement interface
class MyCustomProtocol implements ComProtocol {
  // Your implementation here

// You can also simply override QueueComProtocol
import { QueueComProtocol } from '@iotize/device-client/protocol/impl';

class MyCustomProtocol extends QueueComProtocol {}

class MyCustomProtocol implements ComProtocol{

    // Your implementation here

import TapClientApi

class MyCustomProtocol: ComProtocol{

    // Your implementation here