MCPcopy Create free account
hub / github.com/AI-FanGe/OpenAIglasses_for_Navigation / connectWebSocket

Method connectWebSocket

static/visualizer.js:49–65  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

47 }
48
49 connectWebSocket() {
50 const wsUrl = `ws://${window.location.host}/ws/visualizer`;
51 this.ws = new WebSocket(wsUrl);
52
53 this.ws.onmessage = (event) => {
54 try {
55 this.data = JSON.parse(event.data);
56 this.render();
57 } catch (e) {
58 console.error('Failed to parse visualization data:', e);
59 }
60 };
61
62 this.ws.onclose = () => {
63 setTimeout(() => this.connectWebSocket(), 1000);
64 };
65 }
66
67 render() {
68 const ctx = this.ctx;

Callers 1

constructorMethod · 0.95

Calls 1

renderMethod · 0.95

Tested by

no test coverage detected