169 Commits

Author SHA1 Message Date
Guilherme Alves Ferreira
18faeb3dfa fix(websocket): Update Remaining Websocket Echo Server (#893) 2025-10-01 07:52:42 -03:00
Paolo Pasinetti
2432e41dcb fix(websocket): avoid long stopping time when waiting to auto-reconnect
This commit fixes an issue that occurred when auto-reconnection is enabled,
and the client is disconnected from the server. In this situation, if the
esp_websocket_client_stop() method is called, the caller could remain stuck
waiting for a maximum time equal to half of wait_timeout_ms.

This fix allows the esp_websocket_client_task to be woken up when it is
waiting to reconnect, so it can be closed promptly when requested.
2025-09-19 15:42:33 +02:00
Guilherme Alves Ferreira
870ac91db7 Merge pull request #890 from glmfe/fix/update-ws-echo-server
fix(websocket): Update Websocket Echo Server
2025-09-19 08:35:01 -03:00
glmfe
94bd5b074a fix(websocket): Update Websocket Echo Server 2025-09-19 07:44:12 -03:00
glmfe
ce1560acb1 feat(websocket): Add websocket HTTP redirect
- Handle 301 status (moved permanently) and redirect the connection to the new host.
2025-09-02 09:52:20 -03:00
David Cermak
18418c83ff ci(common): Update test component dir for IDFv6.0
Update websocket, mdns and eppp test apps
2025-08-22 14:23:43 +02:00
glmfe
05715d80d7 bump(websocket): 1.4.0 -> 1.5.0
1.5.0
Features
- add separate tx lock for send and receive (250eebf)
- add unregister event to websocket client (ce16050)
- add ability to reconnect after close (19891d8)
Bug Fixes
- release client-lock during WEBSOCKET_EVENT_DATA (030cb75)
2025-07-22 17:54:02 -03:00
xutao
250eebf3fc feat(websocket): add separate tx lock for send and receive 2025-07-21 10:46:55 +08:00
Euripedes
e71926f6ed Merge pull request #752 from bryghtlabs-richard/feat/websocketReconnectOnClose
feat(websocket): add ability to reconnect after close (IDFGH-15455)
2025-06-27 14:31:16 +02:00
Guilherme Alves Ferreira
3863c26b79 Merge pull request #704 from bryghtlabs-richard/fix/websocketWriterLag
fix(websocket): release client-lock during WEBSOCKET_EVENT_DATA (IDFGH-14545)
2025-04-10 12:16:31 -03:00
glmfe
ce160505dc feat(websocket): add unregister event to websocket client 2025-02-12 08:46:39 -03:00
Richard Allen
030cb75ece fix(websocket): release client-lock during WEBSOCKET_EVENT_DATA
This resolves:

 1) Deadlock when trying to reserve a lock in WEBSOCKET_EVENT_DATA,
    but lock is held by a thread trying to send a websocket message.
 2) High latency caused by writers serialized with WEBSOCKET_EVENT_DATA
    while calling esp_websocket_client_send(), even when TCP window
    has enough space for the entire message being queued to send.

Multiple writers are still serialized at fragment boundaries, but
only with other writers and websocket error updates.

Fixes #625
2025-02-11 12:04:39 -06:00
Richard Allen
19891d8c3c feat(websocket): add ability to reconnect after close
Needed to support protocols like Socket.IO, where some
websocket closes issued by the server are reconnectable.
2025-01-30 12:12:12 -06:00
David Cermak
39866116f5 bump(websocket): 1.3.0 -> 1.4.0
1.4.0
Features
- Support DS peripheral for mutual TLS (55385ec3)
Bug Fixes
- wait for task on destroy (42674b49)
- Fix pytest to verify client correctly (9046af8f)
- propagate error type (eeeb9006)
- fix example buffer leak (5219c39d)
Updated
- chore(websocket): align structure members (beb6e57e)
- chore(websocket): remove unused client variable (15d3a01e)
2025-01-30 07:16:24 +01:00
david-cermak
7740b591b6 Merge pull request #749 from david-cermak/fix/ws_client_test
[websocket]: Fix pytest to verify client correctly
2025-01-30 07:09:34 +01:00
Johan Stokking
42674b49f9 fix(websocket): wait for task on destroy 2025-01-29 14:30:32 +01:00
david-cermak
e069ae7762 Merge pull request #520 from johanstokking/feature/websocket/client_ds_data
feat(websocket): Support DS peripheral for mutual TLS (IDFGH-12285)
2025-01-28 16:59:34 +01:00
Johan Stokking
55385ec312 feat(websocket): Support DS peripheral for mutual TLS 2025-01-28 14:58:54 +01:00
David Cermak
9046af8f8d fix(websocket): Fix pytest to verify client correctly 2025-01-27 15:34:49 +01:00
Johan Stokking
eeeb9006eb fix(websocket): propagate error type 2025-01-25 21:52:06 +01:00
Richard Allen
beb6e57e5e chore(websocket): align structure members 2024-12-16 16:20:21 -06:00
Richard Allen
15d3a01e11 chore(websocket): remove unused client variable 2024-12-16 15:46:43 -06:00
Richard Allen
5219c39d09 fix(websocket): fix example buffer leak 2024-11-04 08:39:13 -06:00
David Cermak
2bcfa45d30 bump(websocket): 1.2.3 -> 1.3.0
1.3.0
Features
- add events for begin/end thread (d7fa24bc)
- Make example to use certificate bundle (aecf6f80)
- propagate esp_tls stack error and cert verify flags (234f579b)
- Add option to set and use cert_common_name in Websocket client (3a6720de)
- adding support for `if_name` when using WSS transport (333a6893)
- allow updating reconnect timeout for retry backoffs (bd9f0627)
- allow using external tcp transport handle (83ea2876)
- adding support for `keep_alive_enable` when using WSS transport (c728eae5)
Bug Fixes
- Prevent crash on network disconnect during send (a453ca1f)
- use proper interface to delete semaphore (991ac40d)
- Move client to different state when disconnecting (0d8f2a6d)
- fix of websocket host example (5ccc018a)
- don't get transport from the list if external transport is used (9d4d5d2d)
- Fix locking issues of `esp_websocket_client_send_with_exact_opcode` API (6393fcd7)
2024-10-31 11:34:02 +01:00
xutao
a453ca1f38 fix(websocket): Prevent crash on network disconnect during send
When WiFi disconnects, `esp_websocket_client_task` continues polling
`esp_transport_poll_read()` with a default 1-second timeout.
If a timeout triggers `esp_websocket_client_abort_connection`,
certain resources are released.
However, if `esp_websocket_client_send_with_exact_opcode`
is still blocked at this point, it will cause a crash
when it times out and accesses the released handle.
This fix prevents potential crashes by ensuring proper
synchronization between abort and send functions.

Merges: https://github.com/espressif/esp-protocols/pull/629
2024-10-31 11:33:26 +01:00
david-cermak
72f4f7c7a3 Merge pull request #683 from bryghtlabs-richard/fix/ws-mutex-delete
fix(websocket): use proper interface to delete semaphore
2024-10-31 10:25:25 +01:00
david-cermak
a353702e04 Merge pull request #626 from euripedesrocha/websocket/fix_race_aborting_connection
Fix race condition when client set to not reconnect
2024-10-31 08:21:52 +01:00
Richard Allen
991ac40d75 fix(websocket): use proper interface to delete semaphore
On most implementations, including ESP-IDF FreeRTOS, vSemaphoreDelete()
is a macro that calls vQueueDelete(). But since the client semaphore is
created with xSemaphoreCreateRecursiveMutex(), delete it as a semaphore with vSemaphoreDelete().
2024-10-30 16:54:45 -05:00
david-cermak
bcab28c1b8 Merge pull request #633 from bryghtlabs-richard/feat/websocketBeginEnd
Feat/websocket: begin end thread events (IDFGH-13507)
2024-08-20 16:41:52 +02:00
Euripedes
60817dd384 Merge pull request #630 from johanstokking/fix/websocket-esp-tls-errors
feat(websocket): propagate esp_tls stack error and cert verify flags
2024-08-20 06:11:55 -03:00
Euripedes Rocha
0d8f2a6d53 fix(websocket): Move client to different state when disconnecting
If Websocket client is set to not reconnect, we move to Unknown state to
clean up the task after dispatching disconnected event.
2024-08-19 12:52:37 +02:00
Richard Allen
d7fa24bc20 feat(websocket): add events for begin/end thread
Add events to signal the start and end of the
websocket thread handler, only once each per client.
2024-08-16 14:45:54 -05:00
Euripedes Rocha
aecf6f80bf feat(websocket): Make example to use certificate bundle
To easy maintenance, makes the example on websocket client to use
certificate bundle by default.
2024-08-16 16:17:10 +02:00
Johan Stokking
234f579bd8 feat(websocket): propagate esp_tls stack error and cert verify flags 2024-08-15 21:14:08 +02:00
Suren Gabrielyan
e583848695 Merge pull request #616 from huming2207/master
fix(websocket): don't fetch transport from the list if external transport is set
2024-07-22 11:34:26 +04:00
Suren Gabrielyan
5ccc018a98 fix(websocket): fix of websocket host example 2024-07-19 15:50:07 +04:00
Jackson Ming Hu
9d4d5d2d49 fix(websocket): don't get transport from the list if external transport is used 2024-07-16 16:53:40 +10:00
Suren Gabrielyan
906e447193 Merge pull request #573 from huming2207/feature/ws-transport-handle
feat(websocket): allow using external TCP transport handle (IDFGH-12825)
2024-07-12 16:50:33 +04:00
Suren Gabrielyan
15ae280bbe Merge pull request #608 from johanstokking/feature/websocket/tls_keepalive_ifname
feat(websocket): adding support for `if_name` when using WSS transport
2024-07-10 12:37:27 +04:00
Suren Gabrielyan
e6f9fe2385 Merge pull request #583 from DCSBL/ws-client-common-name
feat(websocket_client): Add option to set and use cert_common_name in Websocket client (IDFGH-12926)
2024-07-10 12:29:52 +04:00
Duco Sebel
3a6720ded6 feat(websocket): Add option to set and use cert_common_name in Websocket client 2024-07-10 09:19:48 +02:00
Johan Stokking
333a68936a feat(websocket): adding support for if_name when using WSS transport 2024-07-05 13:34:03 +02:00
Erki Aring
bd9f062709 feat(websocket): allow updating reconnect timeout for retry backoffs 2024-07-02 21:07:50 +03:00
Jackson Ming Hu
83ea2876fc feat(websocket): allow using external tcp transport handle 2024-06-21 14:47:03 +10:00
Suren Gabrielyan
6393fcd79a fix(websocket): Fix locking issues of esp_websocket_client_send_with_exact_opcode API
Extended examples to cover more cases
Added new config CONFIG_ESP_WS_CLIENT_ENABLE_DYNAMIC_BUFFER for testing
2024-05-17 12:37:10 +04:00
Suren Gabrielyan
c728eae5ea feat(websocket): adding support for keep_alive_enable when using WSS transport 2024-04-22 10:57:36 +04:00
Suren
1750a3fda9 Merge pull request #535 from gabsuren/websocket_update
bump(websocket): 1.2.2 -> 1.2.3
2024-03-27 17:35:52 +04:00
Suren Gabrielyan
fcc61e0929 fix(websocket): fix of websocket host build 2024-03-26 19:00:03 +04:00
Suren Gabrielyan
a65d81c954 bump(websocket): 1.2.2 -> 1.2.3
1.2.3
Features
- Expanded example to demonstrate the transfer over TLS (0d0630ed76)
Bug Fixes
- fix esp_event dependency management (1fb02a9a60)
- Skip warn on zero timeout and auto reconnect is disabled (5b467cbf5c)
- Fixed to use int return value in Tx functions (9c54b72e1f)
- Fixed Tx functions with DYNAMIC_BUFFER (16174470ee)
- added dependency checks, sdkconfig.defaults and refined README.md (312982e4aa)
- Close websocket and dispatch event if server does not close within a reasonable amount of time. (d85311880d)
- Continue waiting for TCP connection to be closed (2b092e0db4)
Updated
- docs(websocket): Added README for websocket host example (2f7c58259d)
2024-03-22 14:37:13 +04:00
Richard Allen
1fb02a9a60 fix(websocket): fix esp_event dependency management
Move esp_event from PRIV_REQUIRES to REQUIRES, as it is
included by esp_websocket_client.h, so any code including
that header also requires esp_event.

This resolves the following build error for files not
explicitly requiring esp_event:

ninja: build stopped: subcommand failed.
Compilation failed because esp_websocket_client.h (in "espressif__esp_websocket_client" component) includes esp_event.h, provided by esp_event component(s).
However, esp_event component(s) is in the private requirements list of "espressif__esp_websocket_client".
To fix this, move esp_event from PRIV_REQUIRES into REQUIRES list of idf_component_register call in ...\managed_components\espressif__esp_websocket_client\CMakeLists.txt.
ninja failed with exit code 1, output of the command is in...
2024-03-08 10:10:48 -06:00