Skip to content

Commit

Permalink
added sendBinary(bytearr[, offset, length]) method to websocket imp…
Browse files Browse the repository at this point in the history
…lementation
  • Loading branch information
grob committed Mar 6, 2013
1 parent c90c0fc commit 9f56fda
Showing 1 changed file with 18 additions and 1 deletion.
19 changes: 18 additions & 1 deletion modules/ringo/httpserver.js
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@ function Server(options) {
},
/**
* Send a string over the WebSocket.
* @param msg a string
* @param {String} msg a string
* @name WebSocket.instance.send
* @function
*/
Expand All @@ -210,6 +210,23 @@ function Server(options) {
conn.sendMessage(msg);
}
},

/**
* Send a byte array over the WebSocket.
* @param {ByteArray} bytearray The byte array to send
* @param {Number} offset Optional offset (defaults to zero)
* @param {Number} length Optional length (defaults to the
* length of the byte array)
* @function
*/
sendBinary: function(bytearray, offset, length) {
if (conn) {
offset = parseInt(offset, 10) || 0;
length = parseInt(length, 10) || bytearray.length;
conn.sendMessage(bytearray, offset, length);
}
},

/**
* Check whether the WebSocket is open.
* @name WebSocket.instance.isOpen
Expand Down

0 comments on commit 9f56fda

Please sign in to comment.