total5 0.0.17-9 → 0.0.17
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/changelog.txt +1 -0
- package/package.json +1 -1
- package/routing.js +4 -2
- package/websocket.js +19 -19
package/changelog.txt
CHANGED
|
@@ -23,6 +23,7 @@
|
|
|
23
23
|
- improved `Utils.filestreamer()` method by adding percentage
|
|
24
24
|
- fixed sending data to all outputs `$.send(null, [data])` in the FlowStream
|
|
25
25
|
- fixed sending data to all outputs `instance.send(null, [data])` in the FlowStream
|
|
26
|
+
- fixed removing WebSocket route
|
|
26
27
|
|
|
27
28
|
========================
|
|
28
29
|
0.0.16
|
package/package.json
CHANGED
package/routing.js
CHANGED
|
@@ -322,8 +322,10 @@ Route.prototype.remove = function() {
|
|
|
322
322
|
index = F.routes.websockets.indexOf(self);
|
|
323
323
|
if (index !== -1)
|
|
324
324
|
F.routes.websockets.splice(index, 1);
|
|
325
|
-
|
|
326
|
-
conn.
|
|
325
|
+
if (self.connections instanceof Array) {
|
|
326
|
+
for (let conn of self.connections)
|
|
327
|
+
conn.destroy();
|
|
328
|
+
}
|
|
327
329
|
break;
|
|
328
330
|
case 'file':
|
|
329
331
|
index = F.routes.files.indexOf(self);
|
package/websocket.js
CHANGED
|
@@ -694,9 +694,9 @@ WebSocket.prototype.encrypt = function(enable) {
|
|
|
694
694
|
};
|
|
695
695
|
|
|
696
696
|
WebSocket.prototype.find = function(fn) {
|
|
697
|
-
|
|
698
|
-
for (
|
|
699
|
-
|
|
697
|
+
let self = this;
|
|
698
|
+
for (let key in self.connections) {
|
|
699
|
+
let ctrl = self.connections[key];
|
|
700
700
|
if (fn(ctrl))
|
|
701
701
|
return ctrl;
|
|
702
702
|
}
|
|
@@ -704,7 +704,7 @@ WebSocket.prototype.find = function(fn) {
|
|
|
704
704
|
|
|
705
705
|
WebSocket.prototype.send = function(message, comparer, replacer, params) {
|
|
706
706
|
|
|
707
|
-
|
|
707
|
+
let self = this;
|
|
708
708
|
|
|
709
709
|
if (message === undefined)
|
|
710
710
|
return self;
|
|
@@ -714,11 +714,11 @@ WebSocket.prototype.send = function(message, comparer, replacer, params) {
|
|
|
714
714
|
replacer = null;
|
|
715
715
|
}
|
|
716
716
|
|
|
717
|
-
|
|
718
|
-
|
|
717
|
+
let raw = false;
|
|
718
|
+
let data = null;
|
|
719
719
|
|
|
720
|
-
for (
|
|
721
|
-
|
|
720
|
+
for (let key in self.connections) {
|
|
721
|
+
let ctrl = self.connections[key];
|
|
722
722
|
if (data == null) {
|
|
723
723
|
if (ctrl.datatype === 'json') {
|
|
724
724
|
raw = true;
|
|
@@ -740,20 +740,20 @@ WebSocket.prototype.send = function(message, comparer, replacer, params) {
|
|
|
740
740
|
// Ping all connections
|
|
741
741
|
WebSocket.prototype.ping = function() {
|
|
742
742
|
|
|
743
|
-
|
|
743
|
+
let self = this;
|
|
744
744
|
|
|
745
745
|
self.$ping = true;
|
|
746
746
|
F.stats.other.websocketping++;
|
|
747
747
|
|
|
748
|
-
|
|
749
|
-
for (
|
|
748
|
+
let ts = Date.now();
|
|
749
|
+
for (let key in self.connections)
|
|
750
750
|
self.connections[key].ping(ts);
|
|
751
751
|
|
|
752
752
|
return self;
|
|
753
753
|
};
|
|
754
754
|
|
|
755
755
|
WebSocket.prototype.api = function(api) {
|
|
756
|
-
|
|
756
|
+
let self = this;
|
|
757
757
|
|
|
758
758
|
if (!api.startsWith('/@')) {
|
|
759
759
|
if (api[0] !== '@')
|
|
@@ -771,9 +771,9 @@ WebSocket.prototype.api = function(api) {
|
|
|
771
771
|
|
|
772
772
|
WebSocket.prototype.close = function(code, message) {
|
|
773
773
|
|
|
774
|
-
|
|
774
|
+
let self = this;
|
|
775
775
|
|
|
776
|
-
for (
|
|
776
|
+
for (let key in self.connections) {
|
|
777
777
|
self.connections[key].close(code, message);
|
|
778
778
|
delete self.connections[key];
|
|
779
779
|
}
|
|
@@ -783,13 +783,13 @@ WebSocket.prototype.close = function(code, message) {
|
|
|
783
783
|
};
|
|
784
784
|
|
|
785
785
|
WebSocket.prototype.error = function(err) {
|
|
786
|
-
|
|
786
|
+
let self = this;
|
|
787
787
|
F.error(typeof(err) === 'string' ? new Error(err) : err, self.name, self.url);
|
|
788
788
|
};
|
|
789
789
|
|
|
790
790
|
WebSocket.prototype.destroy = function() {
|
|
791
791
|
|
|
792
|
-
|
|
792
|
+
let self = this;
|
|
793
793
|
|
|
794
794
|
if (!self.connections)
|
|
795
795
|
return self;
|
|
@@ -800,15 +800,15 @@ WebSocket.prototype.destroy = function() {
|
|
|
800
800
|
|
|
801
801
|
setTimeout(function(self) {
|
|
802
802
|
|
|
803
|
-
for (
|
|
804
|
-
|
|
803
|
+
for (let key in self.connections) {
|
|
804
|
+
let conn = self.connections[key];
|
|
805
805
|
if (conn) {
|
|
806
806
|
conn.isclosed2 = true;
|
|
807
807
|
conn.socket.removeAllListeners();
|
|
808
808
|
}
|
|
809
809
|
}
|
|
810
810
|
|
|
811
|
-
|
|
811
|
+
let index = self.route.connections.indexOf(self);
|
|
812
812
|
if (index !== -1)
|
|
813
813
|
self.route.connections.splice(index, 1);
|
|
814
814
|
|