TipeeeStream allows you to control the user's scenes and widgets in real time using sockets.
You will need your apiKey to call the endpoints. You can get your apiKey in your account or via OAuth.
All Responses are wrapped in a "data" object.
1. Get the user's informations and his controllable elements
curl -X GET "https://api.tipeeestream.com/v1.0/scenes/remote?apiKey={your-api-key}"
{
"user":{
"id":82,
"username":"lilelulo",
"mediaId":479
},
"scenes":[
{
"id":21,
"token":"588763bb80c74",
"name":"lilelulo Scene 1",
"thumbnailUrl":"\/uploads\/media\/b9da508d4897b5eec79e4d86a2e8747495440a7c.png"
}
]
}
1. Connect via socket to the user's room
var socket = io('https://sso.tipeeestream.com:4242'); socket.on('connect', function(){}); socket.emit('join-room', {room: 'your-api-key', username:'lilelulo'});
3. Get a list of all the items in one given scene
curl -X GET "https://api.tipeeestream.com/v1.0/scenes/{scene-token}?apiKey={your-api-key}"
{
"id": 21,
"token": "588763bb80c74",
"name": "lilelulo Scene 1",
"thumbnailUrl": "\/uploads\/media\/b9da508d4897b5eec79e4d86a2e8747495440a7c.png",
"items": [{
"id": 322,
"name": "Text 1",
"type": "text",
"top": 14.33,
"left": 33.57,
"width": 49.27,
"height": 30.74,
"parameters": {
"content": "My text",
"font_size": "30",
"line_height": "100"
},
"remote_actions": []
},{
"id": 323,
"name": "Text 2",
"type": "text",
"top": 50.00,
"left": 50.00,
"width": 35.27,
"height": 25.74,
"parameters": {
"content": "My text 2",
"font_size": "30",
"line_height": "100"
},
"remote_actions": [{
"code": "trigger",
"name": "Custom action",
"description": "Trigger the custom action you set in the SceneCreator (show\/hide or show for a given duration)"
}]
},{
"id": 324,
"name": "Goal 1",
"type": "widget",
"top": 64.82,
"left": 44.62,
"width": 48.85,
"height": 30.56,
"parameters": {
"token": "5888aae067e73",
"type": "donation_goal"
},
"remote_actions": [
{
"code": "trigger",
"name": "Custom action",
"description": "Trigger the custom action you set in the SceneCreator (show\/hide or show for a given duration)"
}, {
"code": "reset",
"name": "Reset",
"description": "Reset the amount to 0"
}
]
}]
}
The scene items are listed in an array. For each item, the key remote_actions
lists the possible actions that the remote can send via socket, with the code, title and description that you can show in your application.
In this example, the scene contains 3 items :
- - Text 1 : 0 remote actions available
- - Text 2 : 1 remote action available
- - Goal : 2 remote actions available
4. Send commands to TipeeeStream
Send your commands via socket in a object containing :
- event
, a combination of target_id
and action
- appKey
containing the user's api key.
The "target_id" is in the id
key of the scene item, and the "code" is in the code
key of the scene item.
socket.emit('scene-remote-event', { 'event': { 'action': "trigger", 'target_id': 322 }, 'appKey': 'your-api-key' });
socket.emit('scene-remote-event', { 'event': { 'action': "reset", 'target_id': 324 }, 'appKey': 'your-api-key' });