aboutsummaryrefslogtreecommitdiff
path: root/files/zh-cn/web/api/websocket/bufferedamount/index.html
blob: 4162fa92f2c59966371de434b9801e9d29e85641 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
---
title: WebSocket.bufferedAmount
slug: Web/API/WebSocket/bufferedAmount
tags:
  - API
  - Property
  - Reference
  - Web API
  - WebSocket
translation_of: Web/API/WebSocket/bufferedAmount
---
<p>{{APIRef("Web Sockets API")}}</p>

<p><strong><code>WebSocket.bufferedAmount</code>是一个只读属性,用于返回已经被</strong>{{manch("send")}}方法放入队列中但还没有被发送到网络中的数据的字节数。一旦队列中的所有数据被发送至网络,则该属性值将被重置为0。但是,若在发送过程中连接被关闭,则属性值不会重置为0。如果你不断地调用{{manch("send")}},则该属性值会持续增长</p>

<p>The <strong><code>WebSocket.bufferedAmount</code></strong> read-only property returns the number of bytes of data that have been queued using calls to {{manch("send")}} but not yet transmitted to the network. This value resets to zero once all queued data has been sent. This value does not reset to zero when the connection is closed; if you keep calling {{manch("send")}}, this will continue to climb.</p>

<h2 id="Syntax">Syntax</h2>

<pre class="syntaxbox"><em>var bufferedAmount</em> = aWebSocket.bufferedAmount;</pre>

<h2 id="Value">Value</h2>

<p>An <code>unsigned long</code>.</p>

<h2 id="Specifications">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('HTML WHATWG', '#dom-websocket-bufferedamount', 'WebSocket: bufferedAmount')}}</td>
   <td>{{Spec2('HTML WHATWG')}}</td>
   <td>Initial definition</td>
  </tr>
 </tbody>
</table>

<h2 id="Browser_compatibility">Browser compatibility</h2>



<p>{{Compat("api.WebSocket.bufferedAmount")}}</p>