MCPcopy Create free account
hub / github.com/PierreGode/Ragnar / constructor

Method constructor

web/rusense/services/sensing.service.js:39–62  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

37
38class SensingService {
39 constructor() {
40 /** @type {WebSocket|null} */
41 this._ws = null;
42 this._listeners = new Set();
43 this._stateListeners = new Set();
44 this._reconnectAttempt = 0;
45 this._reconnectTimer = null;
46 this._simTimer = null;
47 // Connection state: disconnected | connecting | connected | reconnecting | simulated
48 this._state = 'disconnected';
49 // Data-source label exposed to the UI:
50 // "live" — real ESP32 hardware connected
51 // "server-simulated" — server is running but using synthetic data (no hardware)
52 // "reconnecting" — WebSocket disconnected, retrying
53 // "simulated" — client-side fallback simulation (server unreachable)
54 this._dataSource = 'reconnecting';
55 // The raw source string from the server (e.g. "esp32", "simulated", "simulate")
56 this._serverSource = null;
57 this._lastMessage = null;
58
59 // Ring buffer of recent RSSI values for sparkline
60 this._rssiHistory = [];
61 this._maxHistory = 60;
62 }
63
64 // ---- Public API --------------------------------------------------------
65

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected