Skip to content
This repository was archived by the owner on Oct 25, 2024. It is now read-only.

Commit b15c0bb

Browse files
committed
Temp changes for QUIC.
1 parent 748e215 commit b15c0bb

File tree

5 files changed

+15
-10
lines changed

5 files changed

+15
-10
lines changed

package-lock.json

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/samples/conference/public/quic.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ <h2>Sample of QuicTransport</h2>
3636
</div>
3737
<script src="https://cdnjs.cloudflare.com/ajax/libs/socket.io/2.2.0/socket.io.js" type="text/javascript"></script>
3838
<script src="scripts/rest-sample.js" type="text/javascript"></script>
39-
<script src="../../../../dist/sdk-debug/owt.js" type="text/javascript"></script>
39+
<script src="scripts/owt.js" type="text/javascript"></script>
4040
<script src="scripts/quic.js" type="text/javascript"></script>
4141
</body>
4242

src/samples/conference/public/scripts/index.js

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,6 @@ const runSocketIOSample = function() {
3636
let myId;
3737
let subscriptionForMixedStream;
3838
let myRoom;
39-
let bidirectionalStream;
4039

4140
function getParameterByName(name) {
4241
name = name.replace(/[\[]/, '\\\[').replace(/[\]]/, '\\\]');
@@ -144,9 +143,6 @@ const runSocketIOSample = function() {
144143
conference.join(token).then(resp => {
145144
myId = resp.self.id;
146145
myRoom = resp.id;
147-
conference.createDataStream().then(stream=>{
148-
window.bidirectionalStream=stream;
149-
});
150146
if(mediaUrl){
151147
startStreamingIn(myRoom, mediaUrl);
152148
}
@@ -196,7 +192,6 @@ const runSocketIOSample = function() {
196192
if (stream.source.audio === 'mixed' || stream.source.video ===
197193
'mixed') {
198194
subscribeAndRenderVideo(stream);
199-
return;
200195
}
201196
} else if (stream.source.audio !== 'mixed') {
202197
subscribeAndRenderVideo(stream);

src/sdk/conference/client.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ const SignalingState = {
2727
CONNECTED: 3,
2828
};
2929

30-
const protocolVersion = '1.1';
30+
const protocolVersion = '1.2';
3131

3232
/* eslint-disable valid-jsdoc */
3333
/**

src/sdk/conference/quicconnection.js

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,13 @@ export class QuicConnection extends EventDispatcher {
2929
this._signaling = signaling;
3030
this._ended = false;
3131
this._quicStreams = new Map(); // Key is publication or subscription ID.
32-
this._quicTransport = new QuicTransport(url);
32+
this._quicTransport = new QuicTransport(url, {
33+
serverCertificateFingerprints: [{
34+
value:
35+
'25:47:DA:10:A0:5B:BF:AE:61:A5:C0:53:BB:2E:9C:2C:80:B5:B9:6A:16:2C:97:0A:F2:A4:86:33:3F:02:FF:6A',
36+
algorithm: 'sha-256',
37+
}],
38+
});
3339
this._subscribePromises = new Map(); // Key is subscription ID.
3440
this._transportId = this._token.transportId;
3541
this._init();
@@ -108,7 +114,8 @@ export class QuicConnection extends EventDispatcher {
108114

109115
async _authenticate(token) {
110116
await this._quicTransport.ready;
111-
const quicStream = await this._quicTransport.createSendStream();
117+
const quicStream = await this._quicTransport.createBidirectionalStream();
118+
const chunkReader = quicStream.readable.getReader();
112119
const writer = quicStream.writable.getWriter();
113120
await writer.ready;
114121
// 128 bit of zero indicates this is a stream for signaling.
@@ -119,6 +126,9 @@ export class QuicConnection extends EventDispatcher {
119126
const encodedToken = encoder.encode(token);
120127
writer.write(Uint32Array.of(encodedToken.length));
121128
writer.write(encodedToken);
129+
// Server returns transport ID as an ack. Ignore it here.
130+
await chunkReader.read();
131+
Logger.info('Authentication success.');
122132
}
123133

124134
async createSendStream() {

0 commit comments

Comments
 (0)