HansonServo/websocket_client.h

29 lines
823 B
C

#pragma once
#include <Arduino.h>
// WebSocket client: connect to remote device, receive bytes (e.g. FACE packets).
// Extension to the serial protocol - same packet concepts over WebSocket.
// Runtime-configurable WiFi + WebSocket settings (persisted to NVM)
struct WiFiSettings {
char ssid[33] = "Police Surveillance Van";
char password[65] = "ourpassword";
char host[64] = "192.168.1.206";
uint16_t port = 5001;
char path[32] = "/";
};
extern WiFiSettings wifiSettings;
// Call once from setup() after Serial is ready
void websocketSetup();
// Call every loop() - handles connect, reconnect, and incoming messages
void websocketLoop();
// True when connected and ready to send/receive
bool websocketConnected();
// Force reconnect (call after settings change)
void websocketReconnect();