Skip to content

Commit 3e8fc59

Browse files
committed
WebSocket: Add heartbeatPeriod
1 parent 462e021 commit 3e8fc59

File tree

4 files changed

+20
-2
lines changed

4 files changed

+20
-2
lines changed

web/assets/js/model/inbound.js

+5-1
Original file line numberDiff line numberDiff line change
@@ -379,13 +379,15 @@ class WsStreamSettings extends XrayCommonClass {
379379
acceptProxyProtocol = false,
380380
path = '/',
381381
host = '',
382-
headers = []
382+
headers = [],
383+
heartbeatPeriod = 0,
383384
) {
384385
super();
385386
this.acceptProxyProtocol = acceptProxyProtocol;
386387
this.path = path;
387388
this.host = host;
388389
this.headers = headers;
390+
this.heartbeatPeriod = heartbeatPeriod;
389391
}
390392

391393
addHeader(name, value) {
@@ -402,6 +404,7 @@ class WsStreamSettings extends XrayCommonClass {
402404
json.path,
403405
json.host,
404406
XrayCommonClass.toHeaders(json.headers),
407+
json.heartbeatPeriod,
405408
);
406409
}
407410

@@ -411,6 +414,7 @@ class WsStreamSettings extends XrayCommonClass {
411414
path: this.path,
412415
host: this.host,
413416
headers: XrayCommonClass.toV2Headers(this.headers, false),
417+
heartbeatPeriod: this.heartbeatPeriod,
414418
};
415419
}
416420
}

web/assets/js/model/outbound.js

+9-1
Original file line numberDiff line numberDiff line change
@@ -206,23 +206,31 @@ class KcpStreamSettings extends CommonClass {
206206
}
207207

208208
class WsStreamSettings extends CommonClass {
209-
constructor(path = '/', host = '') {
209+
constructor(
210+
path = '/',
211+
host = '',
212+
heartbeatPeriod = 0,
213+
214+
) {
210215
super();
211216
this.path = path;
212217
this.host = host;
218+
this.heartbeatPeriod = heartbeatPeriod;
213219
}
214220

215221
static fromJson(json = {}) {
216222
return new WsStreamSettings(
217223
json.path,
218224
json.host,
225+
json.heartbeatPeriod,
219226
);
220227
}
221228

222229
toJson() {
223230
return {
224231
path: this.path,
225232
host: this.host,
233+
heartbeatPeriod: this.heartbeatPeriod
226234
};
227235
}
228236
}

web/html/xui/form/outbound.html

+3
Original file line numberDiff line numberDiff line change
@@ -337,6 +337,9 @@
337337
<a-form-item label='{{ i18n "path" }}'>
338338
<a-input v-model.trim="outbound.stream.ws.path"></a-input>
339339
</a-form-item>
340+
<a-form-item label='Heartbeat Period'>
341+
<a-input-number v-model.number="outbound.stream.ws.heartbeatPeriod" :min="0"></a-input-number>
342+
</a-form-item>
340343
</template>
341344

342345
<!-- http -->

web/html/xui/form/stream/stream_ws.html

+3
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,9 @@
99
<a-form-item label='{{ i18n "path" }}'>
1010
<a-input v-model.trim="inbound.stream.ws.path"></a-input>
1111
</a-form-item>
12+
<a-form-item label='Heartbeat Period'>
13+
<a-input-number v-model.number="inbound.stream.ws.heartbeatPeriod" :min="0"></a-input-number>
14+
</a-form-item>
1215
<a-form-item label='{{ i18n "pages.inbounds.stream.tcp.requestHeader" }}'>
1316
<a-button icon="plus" size="small" @click="inbound.stream.ws.addHeader('host', '')"></a-button>
1417
</a-form-item>

0 commit comments

Comments
 (0)