Skip to content

Commit

Permalink
Merge branch 'hotfix/2021.1.3'
Browse files Browse the repository at this point in the history
  • Loading branch information
Yuki Ito committed Jul 30, 2021
2 parents bdfd448 + b98c9de commit 9d79b15
Show file tree
Hide file tree
Showing 8 changed files with 56 additions and 20 deletions.
4 changes: 4 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,10 @@
- FIX
- バグ修正

## 2021.1.3
- [FIX] DataChannel 切断処理を修正する
- 切断タイムアウト処理時にすでに DataChannel の readyState が "closed" 状態であれば onclose を待たないように修正する

## 2021.1.2
- [CHANGE] disconnect API を修正する
- type: disconnect メッセージに reason を追加するように修正する
Expand Down
23 changes: 17 additions & 6 deletions dist/sora.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/**
* @sora/sdk
* undefined
* @version: 2021.1.2
* @version: 2021.1.3
* @author: Shiguredo Inc.
* @license: Apache-2.0
**/
Expand Down Expand Up @@ -1599,7 +1599,7 @@
}
const message = {
type: "connect",
sora_client: "Sora JavaScript SDK 2021.1.2",
sora_client: "Sora JavaScript SDK 2021.1.3",
environment: window.navigator.userAgent,
role: role,
channel_id: channelId,
Expand Down Expand Up @@ -2256,17 +2256,23 @@
closeDataChannels();
resolve();
};
// onclose がすべて発火したかどうかを拾うための Promsie を生成する
// すべての DataChannel の readyState が "closed" になったことを確認する Promsie を生成する
const p = () => {
return new Promise((res, rej) => {
if (dataChannel.readyState === "closed") {
res();
return;
}
dataChannel.onerror = () => {
rej();
};
dataChannel.onclose = (event) => {
const channel = event.currentTarget;
this.writeDataChannelTimelineLog("onclose", channel);
this.trace("CLOSE DATA CHANNEL", channel.label);
res();
if (channel.readyState === "closed") {
res();
}
};
});
};
Expand Down Expand Up @@ -2370,7 +2376,12 @@
}
this.initializeConnection();
if (event) {
this.writeSoraTimelineLog("disconnect-normal", event);
if (event.type === "abend") {
this.writeSoraTimelineLog("disconnect-abend", event);
}
else if (event.type === "normal") {
this.writeSoraTimelineLog("disconnect-normal", event);
}
this.callbacks.disconnect(event);
}
}
Expand Down Expand Up @@ -3433,7 +3444,7 @@
return new SoraConnection(signalingUrl, debug);
},
version: function () {
return "2021.1.2";
return "2021.1.3";
},
helpers: {
applyMediaStreamConstraints,
Expand Down
4 changes: 2 additions & 2 deletions dist/sora.min.js

Large diffs are not rendered by default.

23 changes: 17 additions & 6 deletions dist/sora.mjs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/**
* @sora/sdk
* undefined
* @version: 2021.1.2
* @version: 2021.1.3
* @author: Shiguredo Inc.
* @license: Apache-2.0
**/
Expand Down Expand Up @@ -1593,7 +1593,7 @@ function createSignalingMessage(offerSDP, role, channelId, metadata, options) {
}
const message = {
type: "connect",
sora_client: "Sora JavaScript SDK 2021.1.2",
sora_client: "Sora JavaScript SDK 2021.1.3",
environment: window.navigator.userAgent,
role: role,
channel_id: channelId,
Expand Down Expand Up @@ -2250,17 +2250,23 @@ class ConnectionBase {
closeDataChannels();
resolve();
};
// onclose がすべて発火したかどうかを拾うための Promsie を生成する
// すべての DataChannel の readyState が "closed" になったことを確認する Promsie を生成する
const p = () => {
return new Promise((res, rej) => {
if (dataChannel.readyState === "closed") {
res();
return;
}
dataChannel.onerror = () => {
rej();
};
dataChannel.onclose = (event) => {
const channel = event.currentTarget;
this.writeDataChannelTimelineLog("onclose", channel);
this.trace("CLOSE DATA CHANNEL", channel.label);
res();
if (channel.readyState === "closed") {
res();
}
};
});
};
Expand Down Expand Up @@ -2364,7 +2370,12 @@ class ConnectionBase {
}
this.initializeConnection();
if (event) {
this.writeSoraTimelineLog("disconnect-normal", event);
if (event.type === "abend") {
this.writeSoraTimelineLog("disconnect-abend", event);
}
else if (event.type === "normal") {
this.writeSoraTimelineLog("disconnect-normal", event);
}
this.callbacks.disconnect(event);
}
}
Expand Down Expand Up @@ -3427,7 +3438,7 @@ var sora = {
return new SoraConnection(signalingUrl, debug);
},
version: function () {
return "2021.1.2";
return "2021.1.3";
},
helpers: {
applyMediaStreamConstraints,
Expand Down
2 changes: 1 addition & 1 deletion lerna.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@
"packages": [
"packages/*"
],
"version": "2021.1.2"
"version": "2021.1.3"
}
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "sora-js-sdk",
"version": "2021.1.2",
"version": "2021.1.3",
"description": "WebRTC SFU Sora JavaScript SDK",
"main": "dist/sora.min.js",
"module": "dist/sora.mjs",
Expand Down
2 changes: 1 addition & 1 deletion packages/sdk/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@sora/sdk",
"version": "2021.1.2",
"version": "2021.1.3",
"author": "Shiguredo Inc.",
"license": "Apache-2.0",
"main": "dist/sora.min.js",
Expand Down
16 changes: 13 additions & 3 deletions packages/sdk/src/base.ts
Original file line number Diff line number Diff line change
Expand Up @@ -467,17 +467,23 @@ export default class ConnectionBase {
closeDataChannels();
resolve();
};
// onclose がすべて発火したかどうかを拾うための Promsie を生成する
// すべての DataChannel の readyState が "closed" になったことを確認する Promsie を生成する
const p = (): Promise<void> => {
return new Promise((res, rej) => {
if (dataChannel.readyState === "closed") {
res();
return;
}
dataChannel.onerror = () => {
rej();
};
dataChannel.onclose = (event) => {
const channel = event.currentTarget as RTCDataChannel;
this.writeDataChannelTimelineLog("onclose", channel);
this.trace("CLOSE DATA CHANNEL", channel.label);
res();
if (channel.readyState === "closed") {
res();
}
};
});
};
Expand Down Expand Up @@ -578,7 +584,11 @@ export default class ConnectionBase {
}
this.initializeConnection();
if (event) {
this.writeSoraTimelineLog("disconnect-normal", event);
if (event.type === "abend") {
this.writeSoraTimelineLog("disconnect-abend", event);
} else if (event.type === "normal") {
this.writeSoraTimelineLog("disconnect-normal", event);
}
this.callbacks.disconnect(event);
}
}
Expand Down

0 comments on commit 9d79b15

Please sign in to comment.