aboutsummaryrefslogtreecommitdiff
path: root/files/ja/web/api/rtcdatachannel/index.html
diff options
context:
space:
mode:
Diffstat (limited to 'files/ja/web/api/rtcdatachannel/index.html')
-rw-r--r--files/ja/web/api/rtcdatachannel/index.html128
1 files changed, 128 insertions, 0 deletions
diff --git a/files/ja/web/api/rtcdatachannel/index.html b/files/ja/web/api/rtcdatachannel/index.html
new file mode 100644
index 0000000000..43122cd6d5
--- /dev/null
+++ b/files/ja/web/api/rtcdatachannel/index.html
@@ -0,0 +1,128 @@
+---
+title: RTCDataChannel
+slug: Web/API/RTCDataChannel
+tags:
+ - API
+ - Communication
+ - Data Transfer
+ - Interface
+ - Media
+ - Networking
+ - RTCDataChannel
+ - Reference
+ - WebRTC
+ - WebRTC API
+translation_of: Web/API/RTCDataChannel
+---
+<p>{{APIRef("WebRTC")}}</p>
+
+<p><strong><code>RTCDataChannel</code></strong> インターフェイスは、2 つのピア間で双方向に任意のデータを転送するためのネットワークチャンネルを表現します。すべてのデータチャンネルは {{domxref("RTCPeerConnection")}} に関連付けられており、それぞれのぴあコネクションは理論上、最大 65,534 個のデータチャンネルを持つことができます (実際の上限はブラウザーごとに異なります)。</p>
+
+<p>データチャンネルを作成してリモートのピアに参加するかを問い合わせるには、{{domxref("RTCPeerConnection")}} の {{domxref("RTCPeerConnection.createDataChannel", "createDataChannel()")}} メソッドを呼び出します。データ交換に招かれているピアは {{event("datachannel")}} イベント ({{domxref("RTCDataChannelEvent")}} 型) を受け取って、コネクションにデータチャンネルが追加されたことを知ります。</p>
+
+<h2 id="プロパティ">プロパティ</h2>
+
+<dl>
+ <dt>{{domxref("RTCDataChannel.label")}} {{readOnlyInline}}</dt>
+ <dd>データチャネルを示す名前を含む{{domxref("DOMString")}}を返します。この値に関して固有でなければならない制約はありません。</dd>
+ <dt>{{domxref("RTCDataChannel.ordered")}} {{readOnlyInline}}</dt>
+ <dd>メッセージの配達順序を保証するかしないかを示す{{domxref("Boolean")}}を返します。</dd>
+ <dt>{{domxref("RTCDataChannel.protocol")}} {{readOnlyInline}}</dt>
+ <dd>利用している副プロトコルの名前を含む{{Domxref("DOMString")}}を返します。ない場合は <code>""</code>を返します。</dd>
+ <dt>{{domxref("RTCDataChannel.id")}} {{readOnlyInline}}</dt>
+ <dd>このチャンネルの固有IDを示す <code>unsigned short</code> を返します。この値は、{{domxref("RTCDataChannel")}}オブジェクトの作成時に設定されます。</dd>
+ <dt>{{domxref("RTCDataChannel.readyState")}} {{readOnlyInline}}</dt>
+ <dd>下位のデータコネクションの状態を表現する列挙型の <code>RTCDataChannelState</code> を返します。次のいずれかの値をとります。
+ <ul>
+ <li><code>"connecting"</code>: 下位のコネクションがまだ確立されておらず有効でないことを示します。{{domxref("RTCPeerConnection.createDataChannel()")}}によって生成されたデータチャネルの初期状態です。</li>
+ <li><code>"open"</code>: 下位のコネクションが確立され動作中であることを示します。{{domxref("RTCDataChannelEvent")}} によって、データチャンネルがディスパッチされた時の初期状態です。</li>
+ <li><code>"closing"</code>: 下位のコネクションがシャットダウン処理中であることを示します。新しい送信タスクは受け付けませんが、送信または受信中のキャッシュされたメッセージは処理されます。</li>
+ <li><code>"closed"</code>: 下位のコネクションがシャットダウンされたこと(または、確立できなかったこと)を示します。</li>
+ </ul>
+ </dd>
+ <dt>{{domxref("RTCDataChannel.bufferedAmount")}} {{readOnlyInline}}</dt>
+ <dd>送信キューのバイト量を含む<code>unsigned long</code>を返します。これは、{{domxref("RTCDataChannel.send()")}}を介して送信要求され、まだ送信されていないデータの量です。チャンネルが閉じている場合、バッファリングは継続することに注意してください。</dd>
+ <dt>{{domxref("RTCDataChannel.binaryType")}}</dt>
+ <dd>コネクションによって送信されたバイナリデータの種類を示す{{domxref("DOMString")}}です。この値は、{{domxref("Blob")}}が利用されている場合は<code>"blob"、</code>{{domxref("ArrayBuffer")}}が利用されている場合は<code>"arraybuffer"</code>にすべきです。初期状態では、<code>"blob"</code>が設定されます。</dd>
+ <dt>{{domxref("RTCDataChannel.maxPacketLifeTime")}} {{readOnlyInline}}</dt>
+ <dd>無信頼性モードでのメッセージングでの、ミリ秒単位のウィンドウ長を示す<code>unsigned shortです。</code></dd>
+ <dt>{{domxref("RTCDataChannel.maxRetransmits")}} {{readOnlyInline}}</dt>
+ <dd>無信頼性モードでのメッセージングでの、最大再送信回数を示す<code>unsigned shortです。</code></dd>
+ <dt>{{domxref("RTCDataChannel.negotiated")}} {{readOnlyInline}}</dt>
+ <dd>アプリケーションによってチャンネルがネゴシエーションされたかされていなかを示す{{domxref("Boolean")}}です。</dd>
+ <dt>{{domxref("DataChannel.reliable")}} {{non-standard_inline}} {{readOnlyInline}}</dt>
+ <dd>コネクションはメッセージを無信頼性モードで送信可能かを示す{{domxref("Boolean")}}です。</dd>
+ <dt>{{domxref("DataChannel.stream")}} {{non-standard_inline}} {{readOnlyInline}}</dt>
+ <dd>旧式です。{{domxref("RTCDataChannel.id")}}と同じ意味を持ちます。</dd>
+</dl>
+
+<h3 id="イベントハンドラ">イベントハンドラ</h3>
+
+<dl>
+ <dt>{{domxref("RTCDataChannel.onopen")}}</dt>
+ <dd>{{event("open")}} イベントを受信した時に呼ばれるイベントハンドラです。このイベントは、データコネクションのための下位のデータトランスポートが確立された時に送信されます。</dd>
+ <dt>{{domxref("RTCDataChannel.onmessage")}}</dt>
+ <dd>{{event("message")}} イベントを受信した時に呼ばれるイベントハンドラです。このイベントは、データコネクション上でメッセージを受信した時に送信されます。</dd>
+ <dt>{{domxref("RTCDataChannel.onclose")}}</dt>
+ <dd>{{event("close")}} イベントを受信した時に呼ばれるイベントハンドラです。このイベントは、下位のデータトランスポートが閉じた時に送信されます。</dd>
+ <dt>{{domxref("RTCDataChannel.onerror")}}</dt>
+ <dd>{{event("error")}} イベントを受信した時に呼ばれるイベントハンドラです。このイベントは、エラーに遭遇した時に送信されます。</dd>
+</dl>
+
+<h2 id="メソッド">メソッド</h2>
+
+<dl>
+ <dt>{{domxref("RTCDataChannel.close()")}}</dt>
+ <dd>チャンネルを閉じます。突然でない方法でチャンネルを閉じます。チャンネルの{{domxref("RTCDataChannel.readyState", "state")}} は <code>"closing"</code>に設定され、送信されていないメッセージは送信されてから、チャンネルを閉じます。</dd>
+ <dt>{{domxref("RTCDataChannel.send()")}}</dt>
+ <dd>チャンネルのパラメータに従いデータを送信します。送信可能なデータの型は {{domxref("DOMString")}} または {{domxref("Blob")}}、 {{domxref("ArrayBuffer")}}、{{domxref("ArrayBufferView")}} です。</dd>
+</dl>
+
+<h2 id="例">例</h2>
+
+<pre class="brush: js">var pc = new RTCPeerConnection();
+var dc = pc.createDataChannel("my channel");
+
+dc.onmessage = function (event) {
+ console.log("received: " + event.data);
+};
+
+dc.onopen = function () {
+ console.log("datachannel open");
+};
+
+dc.onclose = function () {
+ console.log("datachannel close");
+};
+</pre>
+
+<h2 id="Specifications" name="Specifications">仕様</h2>
+
+<table class="standard-table">
+ <thead>
+ <tr>
+ <th scope="col">Specification</th>
+ <th scope="col">Status</th>
+ <th scope="col">Comment</th>
+ </tr>
+ </thead>
+ <tbody>
+ <tr>
+ <td>{{ SpecName('WebRTC 1.0', '#idl-def-RTCDataChannel', 'RTCDataChannel') }}</td>
+ <td>{{ Spec2('WebRTC 1.0') }}</td>
+ <td>Initial specification.</td>
+ </tr>
+ </tbody>
+</table>
+
+<h2 id="ブラウザー互換性">ブラウザー互換性</h2>
+
+
+
+<p>{{Compat("api.RTCDataChannel")}}</p>
+
+<h2 id="関連情報">関連情報</h2>
+
+<ul>
+ <li><a href="/docs/Web/Guide/API/WebRTC">WebRTC</a></li>
+</ul>