aotrautils-srv 0.0.104 → 0.0.107
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-13:58:40)»*/
|
|
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-13:58:40)»*/
|
|
4832
4832
|
/*-----------------------------------------------------------------------------*/
|
|
4833
4833
|
|
|
4834
4834
|
|
|
@@ -4862,46 +4862,18 @@ 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
|
-
//let WebSocket;
|
|
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");
|
|
4905
4877
|
|
|
4906
4878
|
|
|
4907
4879
|
|
|
@@ -5093,10 +5065,6 @@ WebsocketImplementation={
|
|
|
5093
5065
|
|
|
5094
5066
|
WebsocketImplementation.isNodeContext=isNodeContext;
|
|
5095
5067
|
|
|
5096
|
-
//const globalContext=(WebsocketImplementation.isNodeContext?global:window);
|
|
5097
|
-
|
|
5098
|
-
|
|
5099
|
-
// cf. https://socket.io/docs/v4/client-socket-instance/
|
|
5100
5068
|
WebsocketImplementation.useSocketIOImplementation=useSocketIOImplementation;
|
|
5101
5069
|
|
|
5102
5070
|
if(WebsocketImplementation.useSocketIOImplementation){
|
|
@@ -5110,18 +5078,12 @@ WebsocketImplementation={
|
|
|
5110
5078
|
}
|
|
5111
5079
|
|
|
5112
5080
|
// *********************************************************************************
|
|
5113
|
-
|
|
5114
|
-
socketIO=require("socket.io");
|
|
5115
|
-
WebSocket=require("ws");
|
|
5116
|
-
|
|
5117
|
-
|
|
5118
5081
|
|
|
5119
5082
|
// DBG
|
|
5120
|
-
console.log("IIIII
|
|
5083
|
+
console.log("IIIII Socket:",JSON.stringify(Socket));
|
|
5121
5084
|
console.log("IIIII WebSocket:",JSON.stringify(WebSocket));
|
|
5122
5085
|
|
|
5123
5086
|
|
|
5124
|
-
|
|
5125
5087
|
return WebsocketImplementation;
|
|
5126
5088
|
},
|
|
5127
5089
|
|
|
@@ -5144,13 +5106,12 @@ WebsocketImplementation={
|
|
|
5144
5106
|
|
|
5145
5107
|
|
|
5146
5108
|
// DBG
|
|
5147
|
-
|
|
5148
|
-
console.log(">>>>>>>socketIO:",JSON.stringify(socketIO));
|
|
5109
|
+
console.log(">>>>>>>Socket:",JSON.stringify(Socket));
|
|
5149
5110
|
console.log(">>>>>>>WebSocket:",JSON.stringify(WebSocket));
|
|
5150
5111
|
|
|
5151
5112
|
// NOW : socket.io :
|
|
5152
5113
|
// Loading socket.io
|
|
5153
|
-
serverSocket=
|
|
5114
|
+
serverSocket=Socket.listen(listenableServer);
|
|
5154
5115
|
|
|
5155
5116
|
// Setting up the disctonnect event :
|
|
5156
5117
|
serverSocket.on("endConnection",()=>{
|
|
@@ -5453,13 +5414,12 @@ WebsocketImplementation={
|
|
|
5453
5414
|
// NOW : socket.io :
|
|
5454
5415
|
//client on server-side:
|
|
5455
5416
|
|
|
5456
|
-
|
|
5457
|
-
if(WebsocketImplementation.isNodeContext && typeof(socketIO)!=="undefined"){
|
|
5417
|
+
if(WebsocketImplementation.isNodeContext && typeof(Socket)!=="undefined"){
|
|
5458
5418
|
// // Node client :
|
|
5459
5419
|
// connectToServer=function (serverURL, port, isSecure, timeout=10000){
|
|
5460
|
-
// return
|
|
5420
|
+
// return Socket.connect(serverURL + ":" + port,{timeout: timeout});
|
|
5461
5421
|
// }
|
|
5462
|
-
clientSocket=
|
|
5422
|
+
clientSocket=Socket.connect(serverURL + ":" + port,{timeout: timeout, secure: isSecure});
|
|
5463
5423
|
}
|
|
5464
5424
|
}
|
|
5465
5425
|
|
aotrautils-srv/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "aotrautils-srv",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.107",
|
|
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)",
|