total5 0.0.17-1 → 0.0.17-2

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 CHANGED
@@ -9,6 +9,9 @@
9
9
  - fixed `mail` priority
10
10
  - fixed `kB` and `GB` units in the routing as upload limits
11
11
  - `DEBUG` is set according to the `process.env.NODE_ENV` variable
12
+ - fixed server pinging of all WebSocket connections
13
+ - improved code
14
+ - fixed typo in send method data assignment
12
15
 
13
16
  ========================
14
17
  0.0.16
package/components.js CHANGED
@@ -233,7 +233,7 @@ Instance.prototype.input = function(input, data, callback) {
233
233
  Instance.prototype.send = function(output, data) {
234
234
  let msg = data instanceof Message ? data : this.newmessage();
235
235
  msg.output = output;
236
- msg.data = data;x
236
+ msg.data = data;
237
237
  msg.send(output);
238
238
  };
239
239
 
package/index.js CHANGED
@@ -1148,10 +1148,10 @@ F.console = function() {
1148
1148
  if (!F.config.$imprint)
1149
1149
  return;
1150
1150
 
1151
- var memory = process.memoryUsage();
1152
- var nodemodules = require.resolve('./index');
1151
+ let memory = process.memoryUsage();
1152
+ let nodemodules = require.resolve('./index');
1153
1153
 
1154
- nodemodules = nodemodules.substring(0, nodemodules.length - (8 + 7));
1154
+ nodemodules = F.Path.dirname(nodemodules);
1155
1155
 
1156
1156
  print('====================================================');
1157
1157
  print('PID : ' + process.pid);
@@ -1171,19 +1171,19 @@ F.console = function() {
1171
1171
  // global.THREAD && print('Thread : ' + global.THREAD);
1172
1172
  print('====================================================');
1173
1173
  F.config.$root && print('Root : ' + F.config.$root);
1174
- print('Directory : ' + process.cwd());
1175
- print('node_modules : ' + nodemodules);
1174
+ print('Directory : ' + F.Path.join(process.cwd(), F.Path.sep));
1175
+ print('node_modules : ' + F.Path.join(nodemodules, F.Path.sep));
1176
1176
  print('====================================================\n');
1177
1177
 
1178
1178
  if (!F.isWorker && F.server) {
1179
1179
 
1180
- var hostname = F.unixsocket ? ('Socket: ' + F.unixsocket) : '{2}://{0}:{1}/'.format(F.config.$ip, F.config.$port, F.isHTTPS ? 'https' : 'http');
1180
+ let hostname = F.unixsocket ? ('Socket: ' + F.unixsocket) : '{2}://{0}:{1}/'.format(F.config.$ip, F.config.$port, F.isHTTPS ? 'https' : 'http');
1181
1181
 
1182
1182
  if (!F.unixsocket && F.ip === '0.0.0.0') {
1183
- var ni = F.Os.networkInterfaces();
1183
+ let ni = F.Os.networkInterfaces();
1184
1184
  if (ni.en0) {
1185
- for (var i = 0; i < ni.en0.length; i++) {
1186
- var nii = ni.en0[i];
1185
+ for (let i = 0; i < ni.en0.length; i++) {
1186
+ let nii = ni.en0[i];
1187
1187
  // nii.family === 'IPv6' ||
1188
1188
  if (nii.family === 'IPv4') {
1189
1189
  hostname += '\n{2}://{0}:{1}/'.format(nii.address, F.port, F.isHTTPS ? 'https' : 'http');
@@ -1215,7 +1215,7 @@ F.loadservices = function() {
1215
1215
  flow.service(F.internal.ticks);
1216
1216
  }
1217
1217
 
1218
- if (F.internal.ticks == 6 || F.internal.ticks == 12)
1218
+ if (F.internal.ticks == 3 || F.internal.ticks == 6 || F.internal.ticks == 12)
1219
1219
  F.TWebSocket.ping();
1220
1220
 
1221
1221
  // 1 minute
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "total5",
3
- "version": "0.0.17-1",
3
+ "version": "0.0.17-2",
4
4
  "description": "Total.js framework v5",
5
5
  "main": "index.js",
6
6
  "directories": {
package/websocket.js CHANGED
@@ -605,10 +605,11 @@ Controller.prototype.senddeflate = function() {
605
605
  };
606
606
 
607
607
  Controller.prototype.ping = function(ts) {
608
- var ctrl = this;
608
+ let ctrl = this;
609
+ ctrl.$ping = ts || Date.now();
610
+ ctrl.latency = null;
609
611
  if (!ctrl.isclosed) {
610
612
  try {
611
- ctrl.$ping = ts || Date.now();
612
613
  ctrl.socket.write(getWebSocketFrame(0, 'PING', 0x09, false, ctrl.masking));
613
614
  } catch (e) {
614
615
  // Socket error
@@ -1366,10 +1367,10 @@ WebSocketClient.prototype.connectforce = function(self, url, protocol, origin) {
1366
1367
 
1367
1368
  WebSocketClient.prototype.ping = function(timeout) {
1368
1369
  var self = this;
1370
+ self.$ping = Date.now();
1369
1371
  if (!self.isclosed && !self.timeout) {
1370
1372
  self.timeout = setTimeout(wsclient_timeout, timeout || 3000, self);
1371
1373
  self.socket.write(getWebSocketFrame(0, 'PING', 0x09, false, self.options.masking));
1372
- self.$ping = Date.now();
1373
1374
  }
1374
1375
  return self;
1375
1376
  };