Skip to content

Commit 9f779cd

Browse files
committed
feat(mosq): Update brokerless example to work with esp-peer
1 parent e9b21ea commit 9f779cd

File tree

4 files changed

+72
-1
lines changed

4 files changed

+72
-1
lines changed
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
From a2d51a026449cf1ba2cb53996ce1cdf1f6f078d2 Mon Sep 17 00:00:00 2001
2+
From: David Cermak <cermak@espressif.com>
3+
Date: Wed, 9 Jul 2025 12:40:36 +0200
4+
Subject: [PATCH] fix(htt): Add default event to http-client handler
5+
6+
---
7+
components/esp_webrtc/impl/apprtc_signal/https_client.c | 2 ++
8+
1 file changed, 2 insertions(+)
9+
10+
diff --git a/components/esp_webrtc/impl/apprtc_signal/https_client.c b/components/esp_webrtc/impl/apprtc_signal/https_client.c
11+
index b7ee6fc..aca4a4e 100644
12+
--- a/components/esp_webrtc/impl/apprtc_signal/https_client.c
13+
+++ b/components/esp_webrtc/impl/apprtc_signal/https_client.c
14+
@@ -48,6 +48,8 @@ esp_err_t _http_event_handler(esp_http_client_event_t *evt)
15+
{
16+
http_info_t *info = evt->user_data;
17+
switch (evt->event_id) {
18+
+ default:
19+
+ break;
20+
case HTTP_EVENT_ERROR:
21+
ESP_LOGD(TAG, "HTTP_EVENT_ERROR");
22+
break;
23+
--
24+
2.25.1

components/mosquitto/examples/serverless_mqtt/CMakeLists.txt

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,22 @@
33
cmake_minimum_required(VERSION 3.16)
44

55
include($ENV{IDF_PATH}/tools/cmake/project.cmake)
6+
7+
execute_process(COMMAND ${CMAKE_BINARY_DIR}/../esp_peer_setup.sh
8+
${CMAKE_BINARY_DIR}
9+
WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
10+
RESULT_VARIABLE script_result
11+
OUTPUT_VARIABLE script_output
12+
ERROR_VARIABLE script_error)
13+
14+
message(STATUS "script_result: ${script_result}")
15+
message(STATUS "script_output: ${script_output}")
16+
message(STATUS "script_error: ${script_error}")
17+
18+
19+
# file(MAKE_DIRECTORY "${CMAKE_BINARY_DIR}/esp-peer/components/")
20+
# file(MAKE_DIRECTORY "${CMAKE_BINARY_DIR}/esp-peer/components/esp_webrtc/impl/peer_default/")
21+
list(APPEND EXTRA_COMPONENT_DIRS "${CMAKE_BINARY_DIR}/esp-peer/components/")
22+
# list(APPEND EXTRA_COMPONENT_DIRS "${CMAKE_BINARY_DIR}/esp-peer/components/esp_webrtc/impl/peer_default/")
23+
624
project(serverless_mqtt)
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
#!/usr/bin/env bash
2+
set -e
3+
echo "bin_dir: $1"
4+
5+
6+
bin_dir="$1"
7+
THIS_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
8+
ESP_PEER_VERSION="9512eef258a45aafcaaa309b1a67505c8b500363"
9+
10+
ESP_PEER_URL="https://github.com/espressif/esp-webrtc-solution/archive/${ESP_PEER_VERSION}.zip"
11+
ESP_PEER_DIR="${bin_dir}/esp-peer"
12+
ZIP_PATH="${bin_dir}/esp-peer.zip"
13+
EXTRACTED_DIR="${ESP_PEER_DIR}/esp-webrtc-solution-${ESP_PEER_VERSION}"
14+
COMPONENTS_SRC="${EXTRACTED_DIR}/components"
15+
COMPONENTS_DST="${ESP_PEER_DIR}/components"
16+
PATCH_FILE="${THIS_DIR}/Add-default-event-to-http-client-handler.patch"
17+
18+
echo $ESP_PEER_DIR
19+
20+
# Download if not exists
21+
if [ ! -d "$EXTRACTED_DIR" ]; then
22+
echo "Downloading esp-peer ${ESP_PEER_VERSION}..."
23+
wget -O "$ZIP_PATH" "$ESP_PEER_URL"
24+
unzip -o "$ZIP_PATH" -d "$ESP_PEER_DIR"
25+
patch -p1 -d "$EXTRACTED_DIR" < "$PATCH_FILE"
26+
mv ${EXTRACTED_DIR}/components ${ESP_PEER_DIR}
27+
mv ${ESP_PEER_DIR}/components/esp_webrtc/impl/peer_default ${ESP_PEER_DIR}/components
28+
fi
Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
idf_component_register(SRCS "serverless_mqtt.c"
22
"wifi_connect.c"
3+
"webrtc.c"
34
INCLUDE_DIRS "."
4-
REQUIRES libjuice nvs_flash mqtt json esp_wifi)
5+
REQUIRES libjuice nvs_flash mqtt json esp_wifi media_lib_sal esp_webrtc peer_default)

0 commit comments

Comments
 (0)