mirror of
https://github.com/linux-odyssey/linux-odyssey.git
synced 2026-11-05 19:20:12 +08:00
feat: add timout settings for reconnectin websocket
This commit is contained in:
1 parent
63e36c1c98
commit
372378021d
1 file changed
+4
-1
@@ -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')
|
||||||
|
|||||||
Reference in new issue
Block a user