aotrautils-srv 0.0.106 → 0.0.109
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.
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
|
|
2
2
|
|
|
3
|
-
/*utils COMMONS library associated with aotra version : «1.0.0.000 (
|
|
3
|
+
/*utils COMMONS library associated with aotra version : «1.0.0.000 (16/07/2022-14:10:43)»*/
|
|
4
4
|
/*-----------------------------------------------------------------------------*/
|
|
5
5
|
|
|
6
6
|
|
|
@@ -4828,7 +4828,7 @@ AOTRAUTILS_LIB_IS_LOADED=true;
|
|
|
4828
4828
|
|
|
4829
4829
|
|
|
4830
4830
|
|
|
4831
|
-
/*utils SERVER library associated with aotra version : «1.0.0.000 (
|
|
4831
|
+
/*utils SERVER library associated with aotra version : «1.0.0.000 (16/07/2022-14:10:43)»*/
|
|
4832
4832
|
/*-----------------------------------------------------------------------------*/
|
|
4833
4833
|
|
|
4834
4834
|
|
|
@@ -4862,46 +4862,20 @@ if(typeof(window)==="undefined") window=global;
|
|
|
4862
4862
|
// https://stackoverflow.com/questions/31156884/how-to-use-https-on-node-js-using-express-socket-io
|
|
4863
4863
|
// https://stackoverflow.com/questions/6599470/node-js-socket-io-with-ssl
|
|
4864
4864
|
// https://nodejs.org/api/https.html#https_https_createserver_options_requestlistener
|
|
4865
|
+
// https://socket.io/docs/v4/client-socket-instance/
|
|
4865
4866
|
|
|
4867
|
+
// NEW : ws :
|
|
4868
|
+
// https://github.com/websockets/ws#installing
|
|
4869
|
+
// https://github.com/websockets/ws/blob/master/doc/ws.md#event-message
|
|
4870
|
+
// ON BROWSER SIDE : Native Websockets :
|
|
4871
|
+
// https://developer.mozilla.org/en-US/docs/Web/API/WebSocket
|
|
4872
|
+
// https://developer.mozilla.org/en-US/docs/Web/API/WebSockets_API/Writing_WebSocket_client_applications
|
|
4866
4873
|
|
|
4867
|
-
|
|
4868
|
-
|
|
4869
|
-
//
|
|
4870
|
-
|
|
4871
|
-
|
|
4872
|
-
//if(typeof(socketIO)==="undefined"){
|
|
4873
|
-
// // TRACE
|
|
4874
|
-
// lognow("«socket.io» SERVER library not called yet, calling it now.");
|
|
4875
|
-
//
|
|
4876
|
-
// socketIO=require("socket.io");
|
|
4877
|
-
//// import { socketIO } from "socket.io";
|
|
4878
|
-
//
|
|
4879
|
-
// // TRACE
|
|
4880
|
-
// lognow("«socket.io» SERVER library called:",socketIO);
|
|
4881
|
-
//
|
|
4882
|
-
//}
|
|
4883
|
-
//if(typeof(socketIO)==="undefined"){
|
|
4884
|
-
// // Exception
|
|
4885
|
-
// lognow("ERROR : «socket.io» SERVER library not found. Cannot launch nodejs server. Aborting.");
|
|
4886
|
-
//}
|
|
4887
|
-
//
|
|
4888
|
-
//// NEW : ws :
|
|
4889
|
-
//// https://github.com/websockets/ws#installing
|
|
4890
|
-
//// https://github.com/websockets/ws/blob/master/doc/ws.md#event-message
|
|
4891
|
-
//// ON BROWSER SIDE : Native Websockets :
|
|
4892
|
-
//// https://developer.mozilla.org/en-US/docs/Web/API/WebSocket
|
|
4893
|
-
//// https://developer.mozilla.org/en-US/docs/Web/API/WebSockets_API/Writing_WebSocket_client_applications
|
|
4894
|
-
//if(typeof(WebSocket)==="undefined"){
|
|
4895
|
-
// WebSocket=require("ws");
|
|
4896
|
-
// // TRACE
|
|
4897
|
-
// lognow("«ws» SERVER library not called yet, calling it now.");
|
|
4898
|
-
//}
|
|
4899
|
-
//if(typeof(WebSocket)==="undefined"){
|
|
4900
|
-
// // TRACE
|
|
4901
|
-
// lognow("ERROR : «ws» SERVER library not found. Cannot launch nodejs server. Aborting.");
|
|
4902
|
-
//}
|
|
4903
|
-
|
|
4904
|
-
|
|
4874
|
+
// We have to import both implementations, regardless of which one is chosen :
|
|
4875
|
+
//const {Socket}=require("socket.io");
|
|
4876
|
+
//const {WebSocket}=require("ws");
|
|
4877
|
+
import { Socket } from "socket.io";
|
|
4878
|
+
import { WebSocket } from "ws";
|
|
4905
4879
|
|
|
4906
4880
|
|
|
4907
4881
|
|
|
@@ -5093,10 +5067,6 @@ WebsocketImplementation={
|
|
|
5093
5067
|
|
|
5094
5068
|
WebsocketImplementation.isNodeContext=isNodeContext;
|
|
5095
5069
|
|
|
5096
|
-
//const globalContext=(WebsocketImplementation.isNodeContext?global:window);
|
|
5097
|
-
|
|
5098
|
-
|
|
5099
|
-
// cf. https://socket.io/docs/v4/client-socket-instance/
|
|
5100
5070
|
WebsocketImplementation.useSocketIOImplementation=useSocketIOImplementation;
|
|
5101
5071
|
|
|
5102
5072
|
if(WebsocketImplementation.useSocketIOImplementation){
|
|
@@ -5110,18 +5080,12 @@ WebsocketImplementation={
|
|
|
5110
5080
|
}
|
|
5111
5081
|
|
|
5112
5082
|
// *********************************************************************************
|
|
5113
|
-
|
|
5114
|
-
socketIO=require("socket.io");
|
|
5115
|
-
WebSocket=require("ws");
|
|
5116
|
-
|
|
5117
|
-
|
|
5118
5083
|
|
|
5119
5084
|
// DBG
|
|
5120
|
-
console.log("IIIII
|
|
5085
|
+
console.log("IIIII Socket:",JSON.stringify(Socket));
|
|
5121
5086
|
console.log("IIIII WebSocket:",JSON.stringify(WebSocket));
|
|
5122
5087
|
|
|
5123
5088
|
|
|
5124
|
-
|
|
5125
5089
|
return WebsocketImplementation;
|
|
5126
5090
|
},
|
|
5127
5091
|
|
|
@@ -5144,13 +5108,12 @@ WebsocketImplementation={
|
|
|
5144
5108
|
|
|
5145
5109
|
|
|
5146
5110
|
// DBG
|
|
5147
|
-
|
|
5148
|
-
console.log(">>>>>>>socketIO:",JSON.stringify(socketIO));
|
|
5111
|
+
console.log(">>>>>>>Socket:",JSON.stringify(Socket));
|
|
5149
5112
|
console.log(">>>>>>>WebSocket:",JSON.stringify(WebSocket));
|
|
5150
5113
|
|
|
5151
5114
|
// NOW : socket.io :
|
|
5152
5115
|
// Loading socket.io
|
|
5153
|
-
serverSocket=
|
|
5116
|
+
serverSocket=Socket.listen(listenableServer);
|
|
5154
5117
|
|
|
5155
5118
|
// Setting up the disctonnect event :
|
|
5156
5119
|
serverSocket.on("endConnection",()=>{
|
|
@@ -5453,13 +5416,12 @@ WebsocketImplementation={
|
|
|
5453
5416
|
// NOW : socket.io :
|
|
5454
5417
|
//client on server-side:
|
|
5455
5418
|
|
|
5456
|
-
|
|
5457
|
-
if(WebsocketImplementation.isNodeContext && typeof(socketIO)!=="undefined"){
|
|
5419
|
+
if(WebsocketImplementation.isNodeContext && typeof(Socket)!=="undefined"){
|
|
5458
5420
|
// // Node client :
|
|
5459
5421
|
// connectToServer=function (serverURL, port, isSecure, timeout=10000){
|
|
5460
|
-
// return
|
|
5422
|
+
// return Socket.connect(serverURL + ":" + port,{timeout: timeout});
|
|
5461
5423
|
// }
|
|
5462
|
-
clientSocket=
|
|
5424
|
+
clientSocket=Socket.connect(serverURL + ":" + port,{timeout: timeout, secure: isSecure});
|
|
5463
5425
|
}
|
|
5464
5426
|
}
|
|
5465
5427
|
|
aotrautils-srv/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "aotrautils-srv",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.109",
|
|
4
4
|
"main": "aotrautils-srv.build.js",
|
|
5
5
|
"description": "A library for vanilla javascript utils (server-side) used in aotra javascript CMS",
|
|
6
6
|
"author": "Jeremie Ratomposon <info@alqemia.com> (https://alqemia.com)",
|