-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
update node js code snippet (generated client) (#696)
- Loading branch information
Showing
15 changed files
with
999 additions
and
170 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -10,7 +10,7 @@ import TabItem from '@theme/TabItem'; | |
const response = await client.<async operation>(); | ||
|
||
// you need to poll this endpoint | ||
const taskResponse = await client.getTaskStatus({id: response.task_id}) | ||
const taskResponse = await client.getTask({id: response.task_id}) | ||
|
||
console.log(taskResponse.status === 'completed'); | ||
``` | ||
|
@@ -45,5 +45,19 @@ curl -X GET https://video.stream-io-api.com/api/v2/tasks/${TASK_ID}?api_key=${AP | |
-H "stream-auth-type: jwt" | ||
``` | ||
|
||
</TabItem> | ||
<TabItem value="js-deprecated" label="[email protected] (deprecated)"> | ||
|
||
```js | ||
// Example of monitoring the status of an async task | ||
// The logic is same for all async tasks | ||
const response = await client.<async operation>(); | ||
|
||
// you need to poll this endpoint | ||
const taskResponse = await client.getTaskStatus({id: response.task_id}) | ||
|
||
console.log(taskResponse.status === 'completed'); | ||
``` | ||
|
||
</TabItem> | ||
</Tabs> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,7 +6,7 @@ import TabItem from '@theme/TabItem'; | |
|
||
```js | ||
// send a custom event to all users watching the call | ||
call.sendCustomEvent({ | ||
call.sendCallEvent({ | ||
custom: { | ||
'render-animation': 'balloons', | ||
}, | ||
|
@@ -36,5 +36,18 @@ curl -X POST https://video.stream-io-api.com/api/v2/video/call/${CALL_TYPE}/${CA | |
}' | ||
``` | ||
|
||
</TabItem> | ||
<TabItem value="js-deprecated" label="[email protected] (deprecated)"> | ||
|
||
```js | ||
// send a custom event to all users watching the call | ||
call.sendCustomEvent({ | ||
custom: { | ||
'render-animation': 'balloons', | ||
}, | ||
user_id: 'john', | ||
}); | ||
``` | ||
|
||
</TabItem> | ||
</Tabs> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,14 +9,8 @@ const resp = await call.get(); | |
|
||
// userId of existing user | ||
const userId = 'jane'; | ||
await client.upsertUsers({ | ||
users: { | ||
[userId]: { | ||
id: userId, | ||
}, | ||
}, | ||
}); | ||
const token = client.createToken(userId); | ||
await client.upsertUsers([{ id: userId }]); | ||
const token = client.generateUserToken({ user_id: userId }); | ||
const rtmpURL = resp.call.ingress.rtmp.address; | ||
const streamKey = token; | ||
|
||
|
@@ -57,5 +51,27 @@ curl -X GET "https://video.stream-io-api.com/api/v2/video/call/livestream/${CALL | |
# Stream key: create a user token | ||
``` | ||
|
||
</TabItem> | ||
<TabItem value="js-deprecated" label="[email protected] (deprecated)"> | ||
|
||
```js | ||
const resp = await call.get(); | ||
|
||
// userId of existing user | ||
const userId = 'jane'; | ||
await client.upsertUsers({ | ||
users: { | ||
[userId]: { | ||
id: userId, | ||
}, | ||
}, | ||
}); | ||
const token = client.createToken(userId); | ||
const rtmpURL = resp.call.ingress.rtmp.address; | ||
const streamKey = token; | ||
|
||
console.log(rtmpURL, streamKey); | ||
``` | ||
|
||
</TabItem> | ||
</Tabs> |
Oops, something went wrong.