esp32_https_server
esp32_https_server copied to clipboard
Initial handshaking
Describe Your Goal
Consider the websocket chat example.
When a client connects I want/need to send an initial update/json to populate the browser with the current parameters/settings.
However, when I add any 'send' calls in the 'create' method the device restarts with :
Guru Meditation Error: Core 1 panic'ed (LoadProhibited). Exception was unhandled.
What Does Your Project Look Like
Adding just a single line to the chat example causes the issue:
WebsocketHandler * ChatHandler::create() { Serial.println("Creating new chat client!"); ChatHandler * handler = new ChatHandler(); for(int i = 0; i < MAX_CLIENTS; i++) { if (activeClients[i] == nullptr) { activeClients[i] = handler; break; } }
handler->send("welcome", SEND_TYPE_TEXT);
return handler; }
ESP32 Module WT32-ETH01
Software (please complete the following information if applicable)
- IDE and Version: Arduino 1.8.15
Additional context What is the correct way to send to a client just after its creation?
FYI A workaround was to have the client, immediately after establishing a connection to the host, request an update. And in the message handler function on the server send the current parameters back to the client.
This is not as direct as having the server push the data, but it is adequate.