Skip to content

Commit 6471e19

Browse files
committed
- support interval option in ping api, and pingInterval option in ews constructor.
- change minimal ping interval from 60s to 20s. - bump version
1 parent 8e5ceef commit 6471e19

File tree

8 files changed

+7545
-4071
lines changed

8 files changed

+7545
-4071
lines changed

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
# Change Logs
22

3+
## v0.0.19
4+
5+
- support `interval` option in `ping` api, and `pingInterval` option in ews constructor.
6+
- change minimal ping interval from 60s to 20s.
7+
8+
39
## v0.0.18
410

511
- watch for `Connection` errors so caller can handle those errors.

LICENSE

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2022-2024 zbryikt
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ Constructor options:
1515
- ignored if `ws` is provided.
1616
- derived from `scheme`, `domain` and `path` above if both `ws` and `url` are omitted
1717
- `scope`: scope of this socket. default ``
18+
- `pingInterval`: optional. interval between ping. default 60s, minimal 20s.
1819

1920

2021
API (ews):
@@ -39,6 +40,7 @@ API (ews):
3940
- `opt` is an object with following field:
4041
- `now`: default false. if false, ping message is sent after ping interval;
4142
otherwise it will be sent immediately.
43+
- `interval: optional. interval of ping. default 60s, minimal 20s.
4244
- `unping()`: stop ping.
4345

4446
API (from original WebSocket):

dist/index.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@
6363
};
6464
this._ping = {
6565
hdr: null,
66-
interval: 60
66+
interval: o.pingInterval || 60
6767
};
6868
this._s = 0;
6969
return this;
@@ -104,7 +104,7 @@
104104
return this$.ping({
105105
now: true
106106
});
107-
}, 1000 * ((ref$ = this._ping.interval || 60) > 60 ? ref$ : 60));
107+
}, 1000 * ((ref$ = opt.interval || this._ping.interval || 60) > 20 ? ref$ : 20));
108108
}, ref$.addEventListener = function(t, cb, o, fromon){
109109
var ref$;
110110
if (!(t === 'message' || t === 'open' || t === 'close' || t === 'error')) {

dist/index.min.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)