Link to API page. Default length for rQshift*
If no length parameter is given to rQshiftStr or rQshiftBytes, then the all remaining data (the full length) will be shifted off. Also, honor the window.WEB_SOCKET_FORCE_FLASH variable to force web-socket-js to be used even if the browser has native WebSockets support.
This commit is contained in:
parent
f69ac8e0a0
commit
40868636da
|
@ -19,6 +19,7 @@ not affect the data between websockify and the server.
|
|||
|
||||
### Websock Javascript library
|
||||
|
||||
|
||||
The `include/websock.js` Javascript library library provides a Websock
|
||||
object that is similar to the standard WebSocket object but Websock
|
||||
enables communication with raw TCP sockets (i.e. the binary stream)
|
||||
|
@ -30,6 +31,8 @@ does not contain actual data but is simply a notification that
|
|||
there is new data available. Several rQ* methods are available to
|
||||
read binary data off of the receive queue.
|
||||
|
||||
The Websock API is documented on the [websock.js API wiki page](https://github.com/kanaka/websockify/wiki/websock.js)
|
||||
|
||||
See the "Wrap a Program" section below for an example of using Websock
|
||||
and websockify as a browser telnet client (`wstelnet.html`).
|
||||
|
||||
|
|
|
@ -17,9 +17,9 @@
|
|||
|
||||
// Load Flash WebSocket emulator if needed
|
||||
|
||||
if (window.WebSocket) {
|
||||
if (window.WebSocket && !window.WEB_SOCKET_FORCE_FLASH) {
|
||||
Websock_native = true;
|
||||
} else if (window.MozWebSocket) {
|
||||
} else if (window.MozWebSocket && !window.WEB_SOCKET_FORCE_FLASH) {
|
||||
Websock_native = true;
|
||||
window.WebSocket = window.MozWebSocket;
|
||||
} else {
|
||||
|
@ -115,6 +115,7 @@ function rQshift32() {
|
|||
(rQ[rQi++] );
|
||||
}
|
||||
function rQshiftStr(len) {
|
||||
if (typeof(len) === 'undefined') { len = rQlen(); }
|
||||
var arr = rQ.slice(rQi, rQi + len);
|
||||
rQi += len;
|
||||
return arr.map(function (num) {
|
||||
|
@ -122,6 +123,7 @@ function rQshiftStr(len) {
|
|||
|
||||
}
|
||||
function rQshiftBytes(len) {
|
||||
if (typeof(len) === 'undefined') { len = rQlen(); }
|
||||
rQi += len;
|
||||
return rQ.slice(rQi-len, rQi);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue