-
Notifications
You must be signed in to change notification settings - Fork 145
/
Copy pathcreateSignalingChannel.js
40 lines (36 loc) · 1.47 KB
/
createSignalingChannel.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
/**
* This file demonstrates the process of creating a KVS Signaling Channel.
*/
async function createSignalingChannel(formValues) {
$('#logs-header')[0].scrollIntoView({
block: 'start',
});
try {
console.log('[CREATE_SIGNALING_CHANNEL] Attempting to create signaling channel with name', formValues.channelName);
// Create KVS client
const kinesisVideoClient = new AWS.KinesisVideo({
region: formValues.region,
accessKeyId: formValues.accessKeyId,
secretAccessKey: formValues.secretAccessKey,
sessionToken: formValues.sessionToken,
endpoint: formValues.endpoint,
});
// Get signaling channel ARN
const createSignalingChannelResponse = await kinesisVideoClient
.createSignalingChannel({
ChannelName: formValues.channelName,
})
.promise();
console.debug(createSignalingChannelResponse.ChannelARN);
// Get signaling channel ARN
const describeSignalingChannelResponse = await kinesisVideoClient
.describeSignalingChannel({
ChannelName: formValues.channelName,
})
.promise();
const channelARN = describeSignalingChannelResponse.ChannelInfo.ChannelARN;
console.log('[CREATE_SIGNALING_CHANNEL] Success! Channel ARN:', channelARN);
} catch (e) {
console.error('[CREATE_SIGNALING_CHANNEL] Encountered error:', e);
}
}