Skip to content
Snippets Groups Projects
Unverified Commit b11c00cc authored by syuilo's avatar syuilo Committed by GitHub
Browse files

Update README.md

parent dfc8a09f
No related branches found
No related tags found
No related merge requests found
......@@ -47,6 +47,8 @@ mainChannel.on('notification', notification => {
});
```
コネクションが途切れても自動で再接続されます。
### チャンネルへの接続
チャンネルへの接続は`useChannel`メソッドを使用します。
......@@ -106,6 +108,31 @@ messagingChannel.send('read', {
});
```
### コネクション確立イベント
ストリーミングインスタンスの`_connected_`イベントが利用可能です。
``` ts
import * as Misskey from 'misskey-js';
const stream = new Misskey.Stream('https://misskey.test', { token: 'TOKEN' });
stream.on('_connected_', () => {
console.log('connected');
});
```
### コネクション切断イベント
ストリーミングインスタンスの`_disconnected_`イベントが利用可能です。
``` ts
import * as Misskey from 'misskey-js';
const stream = new Misskey.Stream('https://misskey.test', { token: 'TOKEN' });
stream.on('_disconnected_', () => {
console.log('disconnected');
});
```
---
<div align="center">
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment