MCPcopy Create free account
hub / github.com/wavetermdev/waveterm / connectNow

Method connectNow

frontend/app/store/ws.ts:70–96  ·  view source on GitHub ↗
(desc: string)

Source from the content-addressed store, hash-verified

68 }
69
70 connectNow(desc: string) {
71 if (this.open || this.noReconnect) {
72 return;
73 }
74 this.lastReconnectTime = Date.now();
75 dlog("try reconnect:", desc);
76 this.opening = true;
77 this.wsConn = newWebSocket(
78 this.baseHostPort + "/ws?stableid=" + encodeURIComponent(this.stableId),
79 this.eoOpts
80 ? {
81 [AuthKeyHeader]: this.eoOpts.authKey,
82 }
83 : null
84 );
85 this.wsConn.onopen = (e: Event) => {
86 this.onopen(e);
87 };
88 this.wsConn.onmessage = (e: MessageEvent) => {
89 this.onmessage(e);
90 };
91 this.wsConn.onclose = (e: CloseEvent) => {
92 this.onclose(e);
93 };
94 // turns out onerror is not necessary (onclose always follows onerror)
95 // this.wsConn.onerror = this.onerror;
96 }
97
98 reconnect(forceClose?: boolean) {
99 if (this.noReconnect) {

Callers 3

reconnectMethod · 0.95
initWshrpcFunction · 0.80
initElectronWshrpcFunction · 0.80

Calls 4

onopenMethod · 0.95
onmessageMethod · 0.95
oncloseMethod · 0.95
newWebSocketFunction · 0.90

Tested by

no test coverage detected