Adds native http wrapper to replace psychic

This commit is contained in:
Rune Harlyk
2026-01-22 20:46:09 +01:00
committed by Rune Harlyk
parent a88c8eb0be
commit 0b8e060063
4 changed files with 440 additions and 0 deletions
@@ -0,0 +1,22 @@
#pragma once
#include <Arduino.h>
#include <communication/native_server.h>
#include <communication/comm_base.hpp>
class NativeWebsocket : public CommAdapterBase {
public:
NativeWebsocket(NativeServer& server, const char* route = "/api/ws");
void begin() override;
private:
NativeServer& server_;
const char* route_;
void onWsOpen(httpd_req_t* req);
void onWsClose(int sockfd);
esp_err_t onFrame(httpd_req_t* req, httpd_ws_frame_t* frame);
void send(const uint8_t* data, size_t len, int cid = -1) override;
};