| Class | FTW::WebSocket::Writer |
| In: |
lib/ftw/websocket/writer.rb
lib/ftw/websocket/writer.rb |
| Parent: | Object |
This class implements a writer for WebSocket messages over a stream.
Protocol diagram copied from RFC6455
0 1 2 3
0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
+-+-+-+-+-------+-+-------------+-------------------------------+
|F|R|R|R| opcode|M| Payload len | Extended payload length |
|I|S|S|S| (4) |A| (7) | (16/64) |
|N|V|V|V| |S| | (if payload len==126/127) |
| |1|2|3| |K| | |
+-+-+-+-+-------+-+-------------+ - - - - - - - - - - - - - - - +
| Extended payload length continued, if payload len == 127 |
+ - - - - - - - - - - - - - - - +-------------------------------+
| |Masking-key, if MASK set to 1 |
+-------------------------------+-------------------------------+
| Masking-key (continued) | Payload Data |
+-------------------------------- - - - - - - - - - - - - - - - +
: Payload Data continued ... :
+ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +
| Payload Data continued ... |
+---------------------------------------------------------------+
| VALID_MODES | = | [:server, :client] |
A list of valid modes. Used to validate input in write_text.
In :server mode, payloads are not masked. In :client mode, payloads are masked. Masking is described in RFC6455. |
|
| VALID_MODES | = | [:server, :client] |
A list of valid modes. Used to validate input in write_text.
In :server mode, payloads are not masked. In :client mode, payloads are masked. Masking is described in RFC6455. |
Write the given text in a websocket frame to the connection.
Valid ‘mode’ settings are :server or :client. If :client, the payload will be masked according to RFC6455 section 5.3: tools.ietf.org/html/rfc6455#section-5.3
Write the given text in a websocket frame to the connection.
Valid ‘mode’ settings are :server or :client. If :client, the payload will be masked according to RFC6455 section 5.3: tools.ietf.org/html/rfc6455#section-5.3