Raw (TCP/UDP/TLS/DTLS)

Some IoT devices could even send a raw payload to the server which is simply a binary UDP/TCP payload. IoTIFY also enables you to provide such payload with ease.

Sending a binary content or even strings over UDP/TCP is possible with IoTIFY. The motivation to use a raw protocol could be either to conserve the bandwidth or to support binary formatting of data. There isn't much to specify when using the raw protocols.

We only need to specify the transport as well as the server endpoint along with the port number. The timeout field is only applicable in case of TCP/TLS/DTLS and specify how long should we wait for connection (as there is no concept of connection in UDP)

Generating Binary Payload for Raw Protocol

For Raw protocol, you could choose to send a binary payload by returning a buffer Object in the Device Model message function. E.g.

{
    payload = [10,20,44,46]
    
    return new Buffer.from(payload);
}

E.g. you could convert a string to base64 representation

    let payload = new Buffer('Hello World', 'binary').toString('base64')
    return payload;

Last updated