Skip to content

Commit e1e9c07

Browse files
committed
feat(ws): implement websocket with supermq
Signed-off-by: Rodney Osodo <[email protected]>
1 parent 65c4042 commit e1e9c07

File tree

6 files changed

+552
-0
lines changed

6 files changed

+552
-0
lines changed
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
cmake_minimum_required(VERSION 3.20.0)
2+
3+
find_package(Zephyr REQUIRED HINTS $ENV{ZEPHYR_BASE})
4+
project(websocket_client)
5+
6+
FILE(GLOB app_sources src/*.c)
7+
target_sources(app PRIVATE ${app_sources})

targets/zephyr/websocket/prj.conf

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
# Wi-Fi Configuration
2+
CONFIG_WIFI=y
3+
4+
# Network Configuration
5+
CONFIG_NET_CONFIG_AUTO_INIT=n
6+
CONFIG_NET_CONNECTION_MANAGER=y
7+
CONFIG_NET_DHCPV4=y
8+
CONFIG_NET_DHCPV4_SERVER=y
9+
CONFIG_NET_IF_MAX_IPV4_COUNT=2
10+
CONFIG_NET_IF_MAX_IPV6_COUNT=2
11+
CONFIG_NET_IPV4=y
12+
CONFIG_NET_L2_ETHERNET=y
13+
CONFIG_NET_L2_WIFI_MGMT=y
14+
CONFIG_NET_MGMT=y
15+
CONFIG_NET_MGMT_EVENT=y
16+
CONFIG_NET_MGMT_EVENT_INFO=y
17+
CONFIG_NET_MGMT_EVENT_QUEUE_SIZE=10
18+
CONFIG_NET_MGMT_EVENT_STACK_SIZE=4096
19+
CONFIG_NET_PKT_RX_COUNT=16
20+
CONFIG_NET_PKT_TX_COUNT=16
21+
CONFIG_NET_SOCKETS_SERVICE_STACK_SIZE=4096
22+
CONFIG_NET_TCP=y
23+
CONFIG_NET_UDP=y
24+
CONFIG_NETWORKING=y
25+
CONFIG_ESP32_WIFI_STA_AUTO_DHCPV4=y
26+
27+
CONFIG_REQUIRES_FULL_LIBC=y
28+
CONFIG_NET_IPV6=y
29+
CONFIG_NET_SOCKETS=y
30+
CONFIG_ZVFS_POLL_MAX=4
31+
CONFIG_POSIX_API=y
32+
CONFIG_CBPRINTF_FP_SUPPORT=y
33+
34+
CONFIG_HTTP_CLIENT=y
35+
CONFIG_WEBSOCKET_CLIENT=y
36+
37+
# LOG Configuration
38+
CONFIG_NET_LOG=y
39+
CONFIG_NET_DHCPV4_SERVER_LOG_LEVEL_DBG=y
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
#ifndef CONFIG_H
2+
#define CONFIG_H
3+
4+
/* STA Mode Configuration */
5+
#define WIFI_SSID "SSID" // Replace `SSID` with WiFi ssid
6+
#define WIFI_PSK "PASSWORD" // Replace `PASSWORD` with Router password
7+
8+
/* Magistrala Configuration */
9+
#define MAGISTRALA_IP \
10+
"MAGISTRALA_IP" // Replace with your Magistrala instance IP
11+
#define MAGISTRALA_WS_PORT 8186
12+
#define DOMAIN_ID "DOMAIN_ID" // Replace with your Domain ID
13+
#define CLIENT_ID "CLIENT_ID" // Replace with your Client ID
14+
#define CLIENT_SECRET "CLIENT_SECRET" // Replace with your Client secret
15+
#define CHANNEL_ID "CHANNEL_ID" // Replace with your Channel ID
16+
17+
#endif

0 commit comments

Comments
 (0)