Commit Graph

27 Commits

Author SHA1 Message Date
Alex Villacís Lasso
a92ee3e0f6 Merge branch 'ul-gh-fix_#888' into yuboxfixes 2021-02-25 18:36:52 -05:00
Alex Villacís Lasso
646eab7bd8 Fix self-deadlock onConnect introduced by ul-gh/fix_#884 branch
Commit 344062ae5b intended to protect the
client list for AsyncEventSource from concurrent access by wrapping
accesses with locking. However, this introduces a self-deadlock scenario
if application code in the onConnect callback (now called with the
client list lock held) tries to broadcast a message to existing
connections in the same AsyncEventSource (for example, to alert of a
new incoming connection). The broadcast call tries to take the lock but
blocks because the lock is already taken, by the same task, before
calling the callback. Fixed by making use of the AsyncWebLockGuard class
which is tailor-made to address this scenario.
2021-01-14 15:13:17 -05:00
Alex Villacís Lasso
600e1d123b Merge branch 'ul-gh-fix_884' into yuboxfixes 2020-12-23 19:36:53 -05:00
Ulrich Lukas
d4bdf996c8 fix #888 omit unnecessary sizeof() for char* 2020-11-19 03:55:12 +01:00
Ulrich Lukas
8012f6e9eb Fix #888, AsyncEventSourceMessage::send()
Tested with 16 kB message size: Respect number of already sent bytes
in successive calls to AsyncEventSourceMessage::send()
2020-11-18 05:00:52 +01:00
Ulrich Lukas
344062ae5b Fix #884, protect list concurrent access with mutex 2020-11-16 15:14:15 +01:00
lorol
2aa029bc40 Cookie Authentication including WS part taken from ayushsharma82 ideas
https://github.com/me-no-dev/ESPAsyncWebServer/pull/684
For Websocket added: void handleHandshake(AwsHandshakeHandler handler) 
For EventSource added: void authorizeConnect(ArAuthorizeConnectHandler cb);

Auth example and modifications. Tested on ESP8266 and ESP32 platforms
See SmartSwitch.ino
2020-05-09 16:55:57 -04:00
lorol
902077553f Applied memory optimizations from sascha432
Updated my additions
2020-04-28 16:36:40 -04:00
Arjan Filius
f13685ee97 AsyncEvents/ServerSideEvents: prevent internal DOS by prevent overflowing messageQueue (#621)
* Prevent tcp/wifi DOS lockup by preventing number of messages in queue, drop otherwise

* Define (renamed) MAX_SSE_Clients
2019-10-17 10:05:13 +03:00
Develo
f3ebe2dea9 Remove warnings for unused params (#620) 2019-10-14 11:30:06 +03:00
Phil Bowles
01019542c2 Add methods to determine Average Queue length (#509)
* Add methods to determine Average Queue length
2019-10-02 15:33:18 +03:00
kaegi
78fe403dda adjust canHandle() for AsyncEventSource (#474) 2019-06-22 17:59:46 +02:00
Me No Dev
77a520ba24 This commit solves issues 172 and 198 (#207)
* This commit solves issues 172 and 198

* This commit solves issues 172 and 198
2017-08-18 17:52:21 +03:00
Alexandr Zarubkin
ab61227a8a The previous event need not be ACKed to send the next one (it will be queued). (#149)
Signed-off-by: Alexandr Zarubkin <me21@yandex.ru>
2017-04-06 10:11:48 +02:00
sticilface
b9641902bf Events Source Message Queue (#129)
* Events Source Message Queue
 - Fixes problem where events sent close together are silently dropped.

* Update AsyncEventSource.cpp

error
2017-03-11 09:57:37 +01:00
Tuan PM
9b66da2c92 Add basic auth for server static (#143)
* Add basic auth for server static

* Also effect to Websocket

* Add http basic auth for event source & document to README.md
2017-03-05 20:02:33 +02:00
Max Lunin
a7c4dfb04f Template container instead of direct pointer manipulation. (#95)
* using Container instead ofdirect pointers list manipulation

* fixed different type of virtual methods.

* Fixed typo in conditional

* Renamed ListArray to LinkedList

* Const reference to String as method parameters to prevent additional copy and memory allocation when String passed by value

* fix 'min' redefinition

* removed #include <iterator>
begin/end methods it's enough for 'for( : )' loop
count() renamed to length()
spacing fixing

* Const reference to String as method parameters to prevent additional copy and memory allocation when String passed by value

* Fixed unused params warnings
2016-11-27 17:42:09 +02:00
me-no-dev
0adc36b1f6 fix mistake 2016-09-23 21:56:28 +03:00
me-no-dev
1fd73a9262 disable timeout for web sockets and event source 2016-09-23 21:44:52 +03:00
Me No Dev
933ac023cb Optimizations 2016-07-14 00:01:34 +03:00
Me No Dev
b8ba1c885b Add EventSource::count() 2016-06-30 11:26:20 +03:00
Me No Dev
330027a8de close event gracefully so pending messages get sent as well 2016-06-29 21:44:33 +03:00
Me No Dev
acd03d5071 syntax error 2016-06-29 21:26:41 +03:00
Me No Dev
8399f0bcb9 add collection of LastEventId header 2016-06-29 21:21:10 +03:00
Me No Dev
a5674fab69 fix onConnect not being called if there are no clients 2016-06-29 20:50:00 +03:00
Me No Dev
0d02922e52 Add onConnect callback to EventSources
usage:
  AsyncEventSource events("/events");
  events.onConnect([](AsyncEventSourceClient *client){
    client->send("Hello!",NULL,0,1000);
  });
  server.addHandler(&events);
  ...
  events.send("boot finished","system");//send "system" event
2016-06-29 19:29:39 +03:00
Me No Dev
cdd1ced67a Add EventSource plugin 2016-06-28 21:51:48 +03:00