mirror of
https://github.com/espressif/esp-protocols.git
synced 2025-07-17 12:32:14 +02:00
ws_client: Optimize example test payloads and timeouts
Important update: NO_DATA_TIMEOUT_SEC=5, as some ws-servers typically send pings in 30s or 10s intervals, so we might never fire shutdown test * Original commit: espressif/esp-idf@323622be64
This commit is contained in:
@ -68,7 +68,7 @@ class Websocket(object):
|
|||||||
|
|
||||||
def test_echo(dut):
|
def test_echo(dut):
|
||||||
dut.expect('WEBSOCKET_EVENT_CONNECTED')
|
dut.expect('WEBSOCKET_EVENT_CONNECTED')
|
||||||
for i in range(0, 10):
|
for i in range(0, 5):
|
||||||
dut.expect(re.compile(r'Received=hello (\d)'), timeout=30)
|
dut.expect(re.compile(r'Received=hello (\d)'), timeout=30)
|
||||||
print('All echos received')
|
print('All echos received')
|
||||||
|
|
||||||
|
@ -24,7 +24,7 @@
|
|||||||
#include "esp_websocket_client.h"
|
#include "esp_websocket_client.h"
|
||||||
#include "esp_event.h"
|
#include "esp_event.h"
|
||||||
|
|
||||||
#define NO_DATA_TIMEOUT_SEC 10
|
#define NO_DATA_TIMEOUT_SEC 5
|
||||||
|
|
||||||
static const char *TAG = "WEBSOCKET";
|
static const char *TAG = "WEBSOCKET";
|
||||||
|
|
||||||
@ -115,7 +115,7 @@ static void websocket_app_start(void)
|
|||||||
xTimerStart(shutdown_signal_timer, portMAX_DELAY);
|
xTimerStart(shutdown_signal_timer, portMAX_DELAY);
|
||||||
char data[32];
|
char data[32];
|
||||||
int i = 0;
|
int i = 0;
|
||||||
while (i < 10) {
|
while (i < 5) {
|
||||||
if (esp_websocket_client_is_connected(client)) {
|
if (esp_websocket_client_is_connected(client)) {
|
||||||
int len = sprintf(data, "hello %04d", i++);
|
int len = sprintf(data, "hello %04d", i++);
|
||||||
ESP_LOGI(TAG, "Sending %s", data);
|
ESP_LOGI(TAG, "Sending %s", data);
|
||||||
|
Reference in New Issue
Block a user