feat: add timout settings for reconnectin websocket

This commit is contained in:
Justin Lin committed 2025-05-05 19:55:40 +08:00
1 parent 63e36c1c98
commit 372378021d
1 file changed
+4 -1
+4 -1
View File
@@ -31,7 +31,10 @@ class SocketTerminal {
connect(url: string): Promise<void> { connect(url: string): Promise<void> {
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
console.log('Connecting to terminal', url) console.log('Connecting to terminal', url)
this.socket = new ReconnectingWebSocket(url) this.socket = new ReconnectingWebSocket(url, [], {
connectionTimeout: 5000,
maxRetries: 10,
})
this.socket.onopen = () => { this.socket.onopen = () => {
console.log('Connected to terminal') console.log('Connected to terminal')
this.term.write('\r\n\x1B[1;32mConnected to terminal\x1B[0m\r\n') this.term.write('\r\n\x1B[1;32mConnected to terminal\x1B[0m\r\n')