Explorar o código

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

ericz %!s(int64=11) %!d(string=hai) anos
pai
achega
cfe8de19b5
Modificáronse 1 ficheiros con 1 adicións e 0 borrados
  1. 1 0
      lib/dataconnection.js

+ 1 - 0
lib/dataconnection.js

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