[Pkg-javascript-commits] [sockjs-client] 136/350: Don't send websockets data as array since it never is.

tonnerre at ancient-solutions.com tonnerre at ancient-solutions.com
Fri Aug 5 01:03:55 UTC 2016


This is an automated email from the git hooks/post-receive script.

tonnerre-guest pushed a commit to branch upstream
in repository sockjs-client.

commit f4c1d29bda2d4266aea48b19aa3b72d22458e253
Author: Bryce Kahle <bkahle at gmail.com>
Date:   Tue Oct 14 12:35:13 2014 -0400

    Don't send websockets data as array since it never is.
---
 lib/main.js                | 3 +++
 lib/transport/websocket.js | 2 +-
 2 files changed, 4 insertions(+), 1 deletion(-)

diff --git a/lib/main.js b/lib/main.js
index 9654ff1..7ae30a8 100644
--- a/lib/main.js
+++ b/lib/main.js
@@ -131,6 +131,9 @@ SockJS.prototype.close = function(code, reason) {
 };
 
 SockJS.prototype.send = function(data) {
+  if (typeof data !== 'string') {
+    throw new TypeError('data must be a string');
+  }
   if (this.readyState === SockJS.CONNECTING) {
     throw new InvalidStateError('The connection has not been established yet');
   }
diff --git a/lib/transport/websocket.js b/lib/transport/websocket.js
index 65373e1..60bbcd0 100644
--- a/lib/transport/websocket.js
+++ b/lib/transport/websocket.js
@@ -51,7 +51,7 @@ util.inherits(WebSocketTransport, EventEmitter);
 
 WebSocketTransport.prototype.send = function(data) {
   debug('send', data);
-  this.ws.send('[' + data + ']');
+  this.ws.send(data);
 };
 
 WebSocketTransport.prototype.close = function() {

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-javascript/sockjs-client.git



More information about the Pkg-javascript-commits mailing list