MCPcopy Create free account
hub / github.com/apache/tvm / onOpen

Method onOpen

web/src/rpc_server.ts:154–168  ·  view source on GitHub ↗
(_event: Event)

Source from the content-addressed store, hash-verified

152 }
153
154 private onOpen(_event: Event): void {
155 // Send the headers
156 let bkey = StringToUint8Array("server:" + this.key);
157 bkey = bkey.slice(0, bkey.length - 1);
158 const intbuf = new Int32Array(1);
159 intbuf[0] = RPC_MAGIC;
160 this.socket.send(intbuf);
161 intbuf[0] = bkey.length;
162 this.socket.send(intbuf);
163 this.socket.send(bkey);
164 this.log("connected...");
165 // request bytes: magic + keylen
166 this.requestBytes(SizeOf.I32 + SizeOf.I32);
167 this.state = RPCServerState.InitHeader;
168 }
169
170 /** Handler for raw message. */
171 private onMessage(event: MessageEvent): void {

Callers 1

constructorMethod · 0.95

Calls 5

logMethod · 0.95
requestBytesMethod · 0.95
StringToUint8ArrayFunction · 0.90
sendMethod · 0.80
sliceMethod · 0.45

Tested by

no test coverage detected