Skip to content

Commit

Permalink
Merge branch 'release/2020.1.1'
Browse files Browse the repository at this point in the history
  • Loading branch information
voluntas committed Jan 28, 2020
2 parents 9b02589 + 08949ab commit 33156cb
Show file tree
Hide file tree
Showing 7 changed files with 28 additions and 15 deletions.
4 changes: 4 additions & 0 deletions CHANGES.md
Expand Up @@ -11,6 +11,10 @@

## develop

## 2020.1.1

- [FIX] on('disconnect') コールバックが発火するように修正する

## 2020.1.0

**リリース番号フォーマットを変更しました**
Expand Down
17 changes: 7 additions & 10 deletions README.md
Expand Up @@ -6,14 +6,12 @@

Web SDK for WebRTC Signaling Server Ayame


## 動作確認環境

- Chrome 77.0.3865.90
- Chrome Canary 79.0.3933.0
- Safari 13.0.1 (14608.2.11.1.11)
- Firefox 69.0.2
- Microsoft Edge Beta 78.2.0.276.11
- Chrome 79.0.3945.130
- Safari 13.0.4 (14608.4.9.1.4)
- Firefox 72.0.2
- Microsoft Edge 79.0.309.71

## サンプル

Expand All @@ -30,21 +28,21 @@ https://openayame.github.io/ayame-web-sdk/index.html
以下のURL を

```
<script src="https://unpkg.com/@open-ayame/ayame-web-sdk@19.9.0/dist/ayame.min.js"></script>
<script src="https://unpkg.com/@open-ayame/ayame-web-sdk@2020.1.1/dist/ayame.min.js"></script>
```

のように指定すると、npm などを経由せず簡単に Ayame を利用することができます。

### unpkg

```
https://unpkg.com/@open-ayame/ayame-web-sdk@19.9.0/dist/ayame.min.js
https://unpkg.com/@open-ayame/ayame-web-sdk@2020.1.1/dist/ayame.min.js
```

### jsdelivr

```
https://cdn.jsdelivr.net/npm/@open-ayame/ayame-web-sdk@19.9.0/dist/ayame.min.js
https://cdn.jsdelivr.net/npm/@open-ayame/ayame-web-sdk@2020.1.1/dist/ayame.min.js
```

### 双方向送受信接続する
Expand Down Expand Up @@ -179,4 +177,3 @@ Ayame Web SDK はオープンソースソフトウェアですが、開発につ
ベストエフォートで運用しています。

https://discord.gg/mDesh2E

10 changes: 8 additions & 2 deletions dist/ayame.js
@@ -1,4 +1,4 @@
/* @OpenAyame/ayame-web-sdk@2020.1 */
/* @OpenAyame/ayame-web-sdk@2020.1.1 */
(function (global, factory) {
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) :
typeof define === 'function' && define.amd ? define(['exports'], factory) :
Expand Down Expand Up @@ -203,6 +203,7 @@
this._ws = new WebSocket(this.signalingUrl);
this._ws.onclose = async () => {
await this._disconnect();
this._callbacks.disconnect({ reason: 'WS-CLOSED' });
return reject('WS-CLOSED');
};
this._ws.onerror = async () => {
Expand Down Expand Up @@ -727,7 +728,12 @@
* @desc PeerConnection 接続を切断します。
*/
async disconnect() {
await this._disconnect();
return new Promise(resolve => {
if (this._ws) {
this._ws.close();
}
return resolve();
});
}
}

Expand Down
2 changes: 1 addition & 1 deletion dist/ayame.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion package.json
@@ -1,6 +1,6 @@
{
"name": "@open-ayame/ayame-web-sdk",
"version": "2020.1.0",
"version": "2020.1.1",
"description": "Web SDK for WebRTC Signaling Server Ayame",
"main": "dist/ayame.min.js",
"scripts": {
Expand Down
1 change: 1 addition & 0 deletions src/connection/base.ts
Expand Up @@ -114,6 +114,7 @@ class ConnectionBase {
this._ws = new WebSocket(this.signalingUrl);
this._ws.onclose = async () => {
await this._disconnect();
this._callbacks.disconnect({ reason: 'WS-CLOSED' });
return reject('WS-CLOSED');
};
this._ws.onerror = async () => {
Expand Down
7 changes: 6 additions & 1 deletion src/connection/index.ts
Expand Up @@ -88,7 +88,12 @@ class Connection extends ConnectionBase {
* @desc PeerConnection 接続を切断します。
*/
public async disconnect(): Promise<void> {
await this._disconnect();
return new Promise(resolve => {
if (this._ws) {
this._ws.close();
}
return resolve();
});
}
}

Expand Down

0 comments on commit 33156cb

Please sign in to comment.