@ceeblue/web-utils 2.4.0 → 2.4.1
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/dist/web-utils.d.ts +6 -4
- package/dist/web-utils.js +15 -9
- package/dist/web-utils.js.map +1 -1
- package/dist/web-utils.min.js +1 -1
- package/dist/web-utils.min.js.map +1 -1
- package/package.json +7 -6
package/dist/web-utils.d.ts
CHANGED
|
@@ -833,19 +833,22 @@ type WebSocketReliableError =
|
|
|
833
833
|
*/
|
|
834
834
|
declare class WebSocketReliable extends EventEmitter {
|
|
835
835
|
/**
|
|
836
|
-
*
|
|
836
|
+
* Fired when socket is connected
|
|
837
|
+
* @event
|
|
837
838
|
*/
|
|
838
839
|
onOpen(): void;
|
|
839
840
|
/**
|
|
840
|
-
*
|
|
841
|
+
* Fired on message reception
|
|
841
842
|
* @param message can be binary or string.
|
|
842
843
|
* If you subscribe to the event with message as string type (and not union),
|
|
843
844
|
* it means that you know that all your messages are distributed in a string format
|
|
845
|
+
* @event
|
|
844
846
|
*/
|
|
845
847
|
onMessage(message: ArrayBuffer | string): void;
|
|
846
848
|
/**
|
|
847
|
-
*
|
|
849
|
+
* Fired on websocket close
|
|
848
850
|
* @param error error description on an improper closure
|
|
851
|
+
* @event
|
|
849
852
|
*/
|
|
850
853
|
onClose(error?: WebSocketReliableError): void;
|
|
851
854
|
/**
|
|
@@ -919,7 +922,6 @@ declare class WebSocketReliable extends EventEmitter {
|
|
|
919
922
|
/**
|
|
920
923
|
* Close websocket
|
|
921
924
|
* @param error the error reason if is not a proper close
|
|
922
|
-
* @param detail detail of the error
|
|
923
925
|
*/
|
|
924
926
|
close(error?: WebSocketReliableError): void;
|
|
925
927
|
private _send;
|
package/dist/web-utils.js
CHANGED
|
@@ -1701,21 +1701,31 @@ Object.freeze(SDP);/**
|
|
|
1701
1701
|
*/
|
|
1702
1702
|
class WebSocketReliable extends EventEmitter {
|
|
1703
1703
|
/**
|
|
1704
|
-
*
|
|
1704
|
+
* Fired when socket is connected
|
|
1705
|
+
* @event
|
|
1705
1706
|
*/
|
|
1706
1707
|
onOpen() { }
|
|
1707
1708
|
/**
|
|
1708
|
-
*
|
|
1709
|
+
* Fired on message reception
|
|
1709
1710
|
* @param message can be binary or string.
|
|
1710
1711
|
* If you subscribe to the event with message as string type (and not union),
|
|
1711
1712
|
* it means that you know that all your messages are distributed in a string format
|
|
1713
|
+
* @event
|
|
1712
1714
|
*/
|
|
1713
1715
|
onMessage(message) { }
|
|
1714
1716
|
/**
|
|
1715
|
-
*
|
|
1717
|
+
* Fired on websocket close
|
|
1716
1718
|
* @param error error description on an improper closure
|
|
1719
|
+
* @event
|
|
1717
1720
|
*/
|
|
1718
|
-
onClose(error) {
|
|
1721
|
+
onClose(error) {
|
|
1722
|
+
if (error) {
|
|
1723
|
+
this.log('onClose', error).error();
|
|
1724
|
+
}
|
|
1725
|
+
else {
|
|
1726
|
+
this.log('onClose').info();
|
|
1727
|
+
}
|
|
1728
|
+
}
|
|
1719
1729
|
/**
|
|
1720
1730
|
* binaryType, fix binary type to arrayBuffer
|
|
1721
1731
|
*/
|
|
@@ -1882,7 +1892,6 @@ class WebSocketReliable extends EventEmitter {
|
|
|
1882
1892
|
/**
|
|
1883
1893
|
* Close websocket
|
|
1884
1894
|
* @param error the error reason if is not a proper close
|
|
1885
|
-
* @param detail detail of the error
|
|
1886
1895
|
*/
|
|
1887
1896
|
close(error) {
|
|
1888
1897
|
if (!this._ws || this._closed) {
|
|
@@ -1894,9 +1903,6 @@ class WebSocketReliable extends EventEmitter {
|
|
|
1894
1903
|
// release resources!
|
|
1895
1904
|
this._queueing.length = 0;
|
|
1896
1905
|
this._queueingBytes = 0;
|
|
1897
|
-
if (error) {
|
|
1898
|
-
this.log(error).error();
|
|
1899
|
-
}
|
|
1900
1906
|
this.onClose(error);
|
|
1901
1907
|
// Reset _opened in last to allow to differenciate in onClose an error while connecting OR while connected
|
|
1902
1908
|
this._opened = false;
|
|
@@ -1913,4 +1919,4 @@ class WebSocketReliable extends EventEmitter {
|
|
|
1913
1919
|
* This file is part of https://github.com/CeeblueTV/web-utils which is released under GNU Affero General Public License.
|
|
1914
1920
|
* See file LICENSE or go to https://spdx.org/licenses/AGPL-3.0-or-later.html for full license details.
|
|
1915
1921
|
*/
|
|
1916
|
-
const VERSION = '2.4.
|
|
1922
|
+
const VERSION = '2.4.1';export{BinaryReader,BinaryWriter,BitReader,ByteRate,Connect,EventEmitter,FixMap,Log,LogType,Loggable,NetAddress,Numbers,Queue,SDP,Util,VERSION,WebSocketReliable,log};//# sourceMappingURL=web-utils.js.map
|