skyway-iot-sdk

API reference - SiRu device

SiRuDevice

Constructor of SiRuDevice. By calling this function, device will join room indicated by roomName.

const device = new SiRuDevice(roomName, [options])

get

set GET interface

device.get(path, callback)

post

set POST interface

device.post(path, callback)

put

set PUT interface

device.put(path, callback)

delete

set delete interface

device.delete(path, callback)

publish

device.publish(topic, data)

publish data to clients in the room. data is distinguished by topic.

subscribe

device.subscribe(topic)

subscribe topic

unsubscribe

device.unsubscribe(topic)

unsubscribe topic

Event

connect

device.on('connect', () => {...})

fired when connected to skyway signaling server and join room procedure has completed.

meta

device.on('meta', meta => { ... })

fired when meta data is received from each device in the room.

message

device.on('message', (topic, message) => { ... })

When published data will be received for subscribed topic. This event will be fired

stream

device.on('stream', stream => { ... })

fired when media streaming is arrived from device.

Request

request object which will be passed to REST interface as 1st argument.

Response

response object which will be passed to REST interface as 2nd argument.

setStatus

set status code for the response

res.setStatus(code)

send

send response to client

res.send(data)

Copyright. NTT Communications All Rights Reserved.