Browse Source

Default reliable to true and return if not connected when trying to send

ericz 11 years ago
parent
commit
cfe8de19b5
1 changed files with 1 additions and 0 deletions
  1. 1 0
      lib/dataconnection.js

+ 1 - 0
lib/dataconnection.js

@@ -118,6 +118,7 @@ DataConnection.prototype.close = function() {
 DataConnection.prototype.send = function(data) {
 DataConnection.prototype.send = function(data) {
   if (!this.open) {
   if (!this.open) {
     this.emit('error', new Error('Connection is not open. You should listen for the `open` event before sending messages.'));
     this.emit('error', new Error('Connection is not open. You should listen for the `open` event before sending messages.'));
+    return;
   }
   }
   if (this._reliable) {
   if (this._reliable) {
     // Note: reliable shim sending will make it so that you cannot customize
     // Note: reliable shim sending will make it so that you cannot customize