Subversion Repositories php-qbpwcf

Rev

Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
14 liveuser 1
WebSocketFrame
2
==============
3
 
4
* [Constructor](#constructor)
5
* [Properties](#properties)
6
 
7
`var WebSocketFrame = require('websocket').frame`
8
 
9
This object represents the low level individual frame and is used to drive how the bytes are serialized onto the wire.
10
 
11
Constructor
12
-----------
13
```javascript
14
new WebSocketFrame();
15
```
16
 
17
Properties
18
----------
19
 
20
###fin
21
*Boolean*
22
 
23
Indicates that this is either the only frame in a message, or the last frame in a fragmentation sequence.
24
 
25
###rsv1
26
*Boolean*
27
 
28
Represents the RSV1 field in the framing, which is currently not used.  Setting this to true will result in a Protocol Error on the receiving peer.
29
 
30
###rsv2
31
*Boolean*
32
 
33
Represents the RSV2 field in the framing, which is currently not used.  Setting this to true will result in a Protocol Error on the receiving peer.
34
 
35
###rsv3
36
*Boolean*
37
 
38
Represents the RSV3 field in the framing, which is currently not used.  Setting this to true will result in a Protocol Error on the receiving peer.
39
 
40
###mask
41
*uint*
42
 
43
Whether or not this frame is (or should be) masked.  For outgoing frames, when connected as a client, this flag is automatically forced to `true` by WebSocketConnection.  Outgoing frames sent from the server-side of a connection are not masked.
44
 
45
###opcode
46
*uint*
47
 
48
Identifies which kind of frame this is.  List of Opcodes:
49
 
50
    Hex  - Dec - Description
51
    0x00 -   0 - Continuation
52
    0x01 -   1 - Text Frame
53
    0x02 -   2 - Binary Frame
54
    0x08 -   8 - Close Frame
55
    0x09 -   9 - Ping Frame
56
    0x0A -  10 - Pong Frame
57
 
58
###length
59
*Read-only, uint*
60
 
61
Identifies the length of the payload data on a received frame.  When sending a frame, the length will be automatically calculated from the `binaryPayload` object.
62
 
63
###binaryPayload
64
*Buffer object*
65
 
66
The binary payload data.  **NOTE**: Even text frames are sent with a Buffer providing the binary payload data.  When sending a UTF-8 Text Frame, you must serialize your string into a Buffer object before constructing your frame, and when receiving a UTF-8 Text Frame, you must deserialize the string from the provided Buffer object.  Do not read UTF-8 data from fragmented Text Frames, as it may have fragmented the data in the middle of a UTF-8 encoded character.  You should buffer all fragments of a text message before attempting to decode the UTF-8 data.