Constructor of SiRuDevice. By calling this function, device will join room indicated by roomName.
const device = new SiRuDevice(roomName, [options])
- roomName - string
- room name which this client will join
- options - object
- option parameter
- options.ssgaddress - string
- IP address of SSG (default is
localhost
)
- IP address of SSG (default is
- options.extport - number
- TCP port number of External interface of SSG (default is 15000)
- options.dashboardport - number
- TCP port number of dashboard interface of SSG (default is 3000)
set GET interface
device.get(path, callback)
- path - string
- REST path
- callback - function
- callback function for this path
set POST interface
device.post(path, callback)
- path - string
- REST path
- callback - function
- callback function for this path
set PUT interface
device.put(path, callback)
- path - string
- REST path
- callback - function
- callback function for this path
set delete interface
device.delete(path, callback)
- path - string
- REST path
- callback - function
- callback function for this path
device.publish(topic, data)
publish data to clients in the room. data is distinguished by topic.
- topic - string
- name of topic
- data - string|object
- arbitrary data
device.subscribe(topic)
subscribe topic
- topic - string
- name of topic
device.unsubscribe(topic)
unsubscribe topic
- topic - string
- name of topic
device.on('connect', () => {...})
fired when connected to skyway signaling server and join room procedure has completed.
device.on('meta', meta => { ... })
fired when meta data is received from each device in the room.
- meta - object
- we will not completely specified for the format of meta data, but
meta.uuid
must be specified. You can see example meta data in profile.yaml
- we will not completely specified for the format of meta data, but
device.on('message', (topic, message) => { ... })
When published data will be received for subscribed topic. This event will be fired
- topic - string
- name of topic
- message - string|object
- arbitrary data which is published
device.on('stream', stream => { ... })
fired when media streaming is arrived from device.
- stream - object
- media stream object.
request object which will be passed to REST interface as 1st argument.
- uuid - string
- uuid of request generator client
- method - string
- method name which is one of 'GET', 'POST', 'PUT', 'DELETE'
- params - object
- request parameter (e.g. device.get('/echo/:message') and GET /echo/hello #=> params.message = hello)
- query - object
- query parameter
- body - string
- request body
response object which will be passed to REST interface as 2nd argument.
set status code for the response
res.setStatus(code)
- code - number
- status code (200, 404 etc.)
send response to client
res.send(data)
- data - string|number|object
- arbitrary data
Copyright. NTT Communications All Rights Reserved.