Commit Graph

43 Commits

Author SHA1 Message Date
David Čermák
ecd3f85794 Merge branch 'bugfix/ws_client_const_correct' into 'master'
ws_client: Fix const correctness on strings (GitHub PR)

Closes IDFGH-5364

See merge request espressif/esp-idf!13952
2021-06-22 16:30:29 +00:00
liuhan
8b02c9026a transport: Add CONFI_WS_TRANSPORT for optimize the code size 2021-06-22 10:51:04 +08:00
0xFEEDC0DE64
70b1247a47 ws_client: Fix const correctness in the API config structure
Merges https://github.com/espressif/esp-idf/pull/7113
2021-06-15 13:46:13 +02:00
yuanjm
c79a907e4f components: Remove repeated keep alive function by ssl layer function
In esp_http_client and esp_websocket_client components, esp_transport_tcp_set_keep_alive has been called and keep-alive config has been saved in ssl->cfg.keep_alive_cfg,
So no need to call esp_transport_ssl_set_keep_alive again.
2021-03-10 02:19:29 +00:00
yuanjm
bead3599ab components: Support bind socket to specified interface in esp_http_client and esp_websocket_client component 2021-03-10 02:19:29 +00:00
Angus Gratton
10bde42551 esp_websocket_client: Don't log the filename when logging "Websocket already stop"
Progress towards https://jira.espressif.com:8443/browse/IDFGH-4477
2021-03-03 10:26:57 +11:00
David Čermák
e615d10b4f Merge branch 'feature/transport_tcp_connection_errors' into 'master'
tcp_transport/esp_tls: Use common TCP transport to reduce code duplication

Closes IDFGH-4405

See merge request espressif/esp-idf!12136
2021-02-16 13:32:47 +00:00
yuanjm
cd01a0ca81 websocket: Add websocket unit tests 2021-02-16 08:29:28 +00:00
David Cermak
99805d880f websockets: Set keepalive options after adding transport to the list
To be in line with other code and mainly to support base/foundation transport used by both tcp and ssl transport layers
2021-02-16 09:00:43 +01:00
Akihiro YAMAZAKI
9ff9137e7a websocket: Add configurable ping interval
Merges https://github.com/espressif/esp-idf/pull/6399

Signed-off-by: David Cermak <cermak@espressif.com>
2021-02-02 14:01:29 +01:00
David Čermák
a461f8f115 Merge branch 'bugfix/ws_transport_ping' into 'master'
ws_transport: Add option to propagate control packets to the app

Closes IDFGH-4478

See merge request espressif/esp-idf!11957
2021-01-22 19:21:43 +08:00
David Cermak
acc7bd2ca4 ws_transport: Add option to propagate control packets to the app
Client could choose if they want to receive control packets and handle
them.
* If disabled (default) the transport itself tries to handle PING
and CLOSE frames automatically during read operation. If handled
correctly, read outputs 0 indicating no (actual app) data received.
* if enabled, all control frames are passed to the application to be
  processed there.

Closes https://github.com/espressif/esp-idf/issues/6307
2021-01-22 07:22:41 +00:00
Shubham Kulkarni
b53e46a68e Add options for esp_http_client and esp_websocket_client to support keepalive 2021-01-22 06:56:28 +00:00
yuanjm
5ab774f9d8 websocket: support mutual tls for websocket
Closes https://github.com/espressif/esp-idf/issues/6059
2021-01-08 19:13:37 +00:00
Angus Gratton
66fb5a29bb Whitespace: Automated whitespace fixes (large commit)
Apply the pre-commit hook whitespace fixes to all files in the repo.

(Line endings, blank lines at end of file, trailing whitespace)
2020-11-11 07:36:35 +00:00
Marius Vikhammer
c2bb0762bb Websocket client: avoid deadlock if stop called from event handler 2020-08-21 18:57:45 +08:00
David Cermak
5e9f8b52e7 tcp_transport: Added internal API for underlying socket, used for custom select on connection end for WS
Internal tcp_transport functions could now use custom socket operations.
This is used for WebSocket transport, when we typically wait for clean
connection closure, i.e. selecting for read/error with expected errno or
recv size=0 while socket readable (=connection terminated by FIN flag)
2020-08-18 06:42:22 +00:00
David Cermak
b213f2c6d3 ws_client: Added support for close frame, closing connection gracefully 2020-08-18 06:42:22 +00:00
Chen Yi Qun
caaf62bdad driver, http_client, web_socket, tcp_transport: remove __FILE__ from log messages
__FILE__ macro in the error messages adds full paths to the production binarys, remove __FILE__ from the ESP_LOGE.

Closes https://github.com/espressif/esp-idf/issues/5637
Merges https://github.com/espressif/esp-idf/pull/5638
2020-08-03 15:21:36 +08:00
xutao
341e480573 websocket_client : fix some issues for websocket client
1. will post twice disconnect event when read error
2. will block `timeout` times when set disable_auto_connect
3. When `esp_websocket_client_stop` before `esp_websocket_client_send*`,
if the `esp_websocket_client_send*` fails, the status will change to
 'WEBSOCKET_STATE_WAIT_TIMEOUT', and the next `esp_websocket_client_start` will fail forever
2020-07-24 22:08:37 +08:00
David Čermák
f74d5d9517 Merge branch 'bugfix/ws_send_abort' into 'master'
websocket client: the client now aborts the connection if send fails.

Closes IDF-1744

See merge request espressif/esp-idf!8891
2020-06-16 03:36:17 +08:00
Marius Vikhammer
0049385850 websocket: add configurable timeout for PONG not received
Closes IDF-1744
2020-06-12 09:43:29 +00:00
Marius Vikhammer
6bebfc84f3 websocket client: the client now aborts the connection if send fails.
Closes IDF-1744
2020-05-28 06:31:46 +00:00
David Cermak
14992e62c5 ws_client: fix fragmented send setting proper opcodes
Previous implementation violated the RFC by having both the actual opcode and WS_FIN flag set for all fragments of a message.
Fixed by setting the opcode only for the first fragment and WS_FIN for the last one

Closes IDFGH-2938
Closes https://github.com/espressif/esp-idf/issues/4974
2020-04-14 16:11:32 +02:00
Konstantin Kondrashov
739eb05bb9 esp32: add implementation of esp_timer based on TG0 LAC timer
Closes: IDF-979
2020-02-06 14:00:18 +08:00
Marius Vikhammer
ffeda3003c tcp_transport/ws_client: websockets now correctly handle messages longer than buffer
transport_ws can now be read multiple times in a row to read frames larger than the buffer.

Added reporting of total payload length and offset to the user in websocket_client.

Added local example test for long messages.

Closes IDF-1083
2020-01-06 17:18:13 +08:00
Marius Vikhammer
7c0e3765ec websocket: added missing event data
user_context was missing from websocket event data, added. Also added the websocket client handle to the event data.

Removed  unused event data struct.

Closes: IDF-1271
2019-12-19 17:36:37 +08:00
David N. Junod
9200250f51 Add User-Agent and additional headers to esp_websocket_client
Merges https://github.com/espressif/esp-idf/pull/4345
2019-11-21 21:14:29 +01:00
David Cermak
e1f982921a ws_client: fix handling timeouts by websocket client.
tcp-transport component did not support wait forever. this update uses value of -1 to request this state.
websocket client uses timeouts in RTOS ticks. fixed recalculation to ms (including special value of -1) to use correctly tcp-transport component

Closes https://github.com/espressif/esp-idf/issues/4316
2019-11-18 10:59:41 +00:00
David Cermak
7c5011f411 websocket_client: fix locking mechanism in ws-client task and when sending data
closes https://github.com/espressif/esp-idf/issues/4169
2019-10-24 07:09:31 +00:00
David Cermak
abf9345b85 ws_client: fix for not sending ping responses, updated to pass events also for PING and PONG messages, added interfaces to send both binary and text data
closes https://github.com/espressif/esp-idf/issues/3982
2019-10-14 11:05:27 +02:00
Angus Gratton
92a507c0aa Merge branch 'bugfix/ws_client_fix_event_blocking' into 'master'
ws_client: fixed posting to event loop with websocket timeout

See merge request espressif/esp-idf!5901
2019-10-14 15:17:34 +08:00
David Cermak
271e6c4c9c websocket_client: fix URI parsing to include also query part in websocket connection path
closes https://github.com/espressif/esp-idf/issues/4090
2019-10-07 16:40:38 +02:00
David Cermak
50505068c4 ws_client: fixed posting to event loop with websocket timeout
Executing event loop `esp_event_loop_run()` with timeout causes delays in receiving events from user code. Fixed by removing the timeout to post synchronously.

closes https://github.com/espressif/esp-idf/issues/3957
2019-10-07 16:34:51 +02:00
David Cermak
de6ea396f1 ws_client: added subprotocol configuration option to websocket client
closes https://github.com/espressif/esp-idf/issues/3893
2019-10-03 07:33:32 +02:00
David Cermak
c0ba9e19fc ws_client: fixed path config issue when ws server configured using host and path instead of uri
closes https://github.com/espressif/esp-idf/issues/3892
2019-10-03 07:33:32 +02:00
David Cermak
adee25d90e ws_client: fixed transport config option when server address configured as host, port, transport rather then uri
closes https://github.com/espressif/esp-idf/issues/3891
2019-10-03 07:33:32 +02:00
liu zhifu
003a9872b7 esp_wifi: wifi support new event mechanism
1. WiFi support new event mechanism
2. Update examples to use new event mechanism
2019-08-20 09:39:51 +00:00
Anton Maklakov
afbaf74007 tools: Mass fixing of empty prototypes (for -Wstrict-prototypes) 2019-08-01 16:28:56 +07:00
David Cermak
9b507c45c8 ws_client: fix double delete issue in ws client initialization 2019-07-15 13:15:07 +02:00
David Cermak
d1433564ec ws_client: removed dependency on internal tcp_transport header 2019-07-04 20:55:10 +02:00
Renz Christian Bagaporo
6771eead80 examples: use new component registration api 2019-06-21 19:53:29 +08:00
Tuan
2a2d932cfe esp_websocket_client: Add websocket client component
Closes https://github.com/espressif/esp-idf/issues/2829
2019-06-20 15:37:40 +08:00