Commit Graph

40 Commits

Author SHA1 Message Date
Develo f3ebe2dea9 Remove warnings for unused params (#620) 2019-10-14 11:30:06 +03:00
SharkSharp 4a34b46cc0 make the query parameters available by passing the request to WS_EVT_CONNECT (#559)
Signed-off-by: Arthur Frederico Neves <arthurfred.neves@gmail.com>
2019-10-02 15:16:35 +03:00
sascha lammers 403752a942 Added method to access clients of AsyncWebSocket (#583)
* Added method to access clients of AsyncWebSocket

* https://github.com/me-no-dev/ESPAsyncWebServer/issues/571

* Conflict with crypto library
2019-10-02 14:16:43 +03:00
matt123p 2f37037029 Add function so that the total number of web-socket clients can be limited (#591)
* Add function so that the total number of web-socket clients can be limited easily.  This is to cope with a problem when a browser does not close the web-socket connection correctly.  I have observed this on Chromium based browsers.  The memory leak will eventually lead to the server crashing.  Normally only one connection per client is required, so limiting the number of connections would not normally cause any problems.

* Prevent an assertion failure when using WebSockets

Frequently when using Web Sockets you will get the assert failure:
    	assertion "new_rcv_ann_wnd <= 0xffff" failed: file "/Users/ficeto/Desktop/ESP32/ESP32/esp-idf-public/components/lwip/lwip/src/core/tcp.c", line 779, function: tcp_update_rcv_ann_wnd

This will happen particulary when you close the browser window.  This change
prevents the issue from occuring.

* Do not use thread locking with the ESP8266, but instead use an empty placeholder class that can be used to implement locking at a later date.

* Do not use thread locking with the ESP8266, but instead use an empty placeholder class that can be used to implement locking at a later date.

* Add function so that the total number of web-socket clients can be limited easily.  This is to cope with a problem when a browser does not close the web-socket connection correctly.  I have observed this on Chromium based browsers.  The memory leak will eventually lead to the server crashing.  Normally only one connection per client is required, so limiting the number of connections would not normally cause any problems.

* Set the default number of ws clients dependent on processor.
2019-09-24 22:42:40 +03:00
ray 7c6118f2a0 arg should be closed by va_end() (#601) 2019-09-22 08:58:15 +03:00
matt123p 5ea49e313d Prevent an assertion failure when using WebSockets (#584)
Frequently when using Web Sockets you will get the assert failure:
    	assertion "new_rcv_ann_wnd <= 0xffff" failed: file "/Users/ficeto/Desktop/ESP32/ESP32/esp-idf-public/components/lwip/lwip/src/core/tcp.c", line 779, function: tcp_update_rcv_ann_wnd

This will happen particulary when you close the browser window.  This change
prevents the issue from occuring.
2019-09-21 13:27:34 +03:00
matt123p aea43f98d1 Add thread locking to improve stability. (#585)
* Add thread locking to improve stability.

* Do not use thread locking with the ESP8266, but instead use an empty placeholder class that can be used to implement locking at a later date.
2019-09-12 19:56:13 +03:00
Luc 736a54af1a Allows to check queue status (#411) 2019-06-22 18:51:01 +02:00
dyarkovoy 5ef7ffcd41 Detect if AsyncWebSocketClient can send data to server and add AsyncWebServer::end() (#501)
* added AsyncWebServer::end()

* added AsyncWebServer::end()

* added bool AsyncWebSocketClient::canSend()

* Fix comparison with WS_MAX_QUEUED_MESSAGES

* Fix comparison with WS_MAX_QUEUED_MESSAGES
2019-06-22 18:47:43 +02:00
me-no-dev bed4146ec6 add limit to how many messages can be queued for each web socket client 2018-08-18 21:10:39 +02:00
me-no-dev 4c621f340c improve web socket rapid sends a bit
to fully fix any possible issues, ws should use FreeRTOS Queues on ESP32
2018-08-15 23:55:03 +02:00
Chris Byrne b6b43d35fa Handle multiple WebSocket frames within a TCP packet (#338) 2018-07-24 20:22:54 +02:00
me-no-dev decdca5a73 git went crazy 2018-07-05 11:07:47 +02:00
me-no-dev b63ed5d93f fix wrong buffer length in web socket reserve 2018-07-05 11:06:51 +02:00
Qc 64adf2972d Update AsyncWebSocket.cpp (#247) 2017-11-06 15:54:49 +02:00
omersiar d366e7c539 This re-enables previously removed WebSocket authentication which is … (#272)
* This re-enables previously removed WebSocket authentication which is orginaly implemented PR #143

* Update README.md
2017-10-30 09:43:31 +01:00
me-no-dev 313f3372c6 Don't send Content Length for WS 101
Fixes: https://github.com/me-no-dev/ESPAsyncWebServer/issues/255
Thanks @keduro :)
2017-10-10 22:38:13 +03:00
me-no-dev 3e6690396a Some small adjustments for ESP32
- bump version
- remove compilation warnings
- do not require SPIFFS
2017-09-09 09:04:50 +03:00
me-no-dev d37bd16c22 Initial ESP32 compatibility 2017-09-07 22:01:58 +03: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
Trygve Laugstøl be12e0c171 Fixing compiler warnings exposed with -Wall and -Wextra: (#159)
AsyncWebHandler::setAuthentication: return is required.
AsyncWebSocketMultiMessage::~AsyncWebSocketMultiMessage: error: enumeral and non-enumeral type in conditional expression.
2017-04-20 11:14:00 +03:00
sticilface 1b35f15ec2 Web Sockets memory improvements : shared message buffer, direct buffer access (#144)
* Add support for a MultiMessage where the buffer is shared between WS messages to multiple clients.
Add ability to create a WS buffer directly and write to it, saving duplication of message in RAM, then send it.  example below is an arduinoJson message.

```cpp
void sendDataWs(AsyncWebSocketClient * client)
{
    DynamicJsonBuffer jsonBuffer;
    JsonObject& root = jsonBuffer.createObject();
    root["a"] = "abc";
    root["b"] = "abcd";
    root["c"] = "abcde";
    root["d"] = "abcdef";
    root["e"] = "abcdefg";
    size_t len = root.measureLength();
    AsyncWebSocketMessageBuffer * buffer = ws.makeBuffer(len); //  creates a buffer (len + 1) for you.
    if (buffer) {
        root.printTo((char *)buffer->get(), len + 1);
        if (client) {
            client->text(buffer);
        } else {
            ws.textAll(buffer);
        }
    }
}
```

* Add example to readme.
2017-03-14 14:55:39 +01:00
sticilface edf6c75f8c Fix memory leak in __flashString Web sockets implementation. (#136) 2017-03-05 20:07:17 +02: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
Sakari Kapanen ea7b76b0ee Fix const correctness of _sourceValid (#100) 2016-11-28 22:00: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
Sergey Anisimov b3db252acb Passing String parameters by const ref. (#57) 2016-07-25 20:07:02 +03:00
Me No Dev 933ac023cb Optimizations 2016-07-14 00:01:34 +03:00
Me No Dev dce6d35ad4 close the web socket instead of aborting it
latest ESPAsyncTCP commits are needed for this to properly work
fixing: https://github.com/me-no-dev/ESPAsyncWebServer/issues/48
2016-06-28 13:35:32 +03:00
Me No Dev bda2cd637a add WebSocket auto-ping option and fix pcb not being released properly on disconnect 2016-05-28 03:50:38 +03:00
Me No Dev 2b501e74a7 add method to disable new connections to a WebSocket instance 2016-05-25 19:48:04 +03:00
Charles 29b3f72e80 Added printf_P method (#31)
* Prevent buffer overflow on received data

* pass to 7 char to avoid save to flash by SDK

* return _contentLength, avoid array reparse to know len

* Added FlashStringHelper for text and binary

* Added FlashStringHelper also to AsyncWebSocketClient

* Added PROGMEM doc

* Corrected binary was sending PSTR as text, addded len

* Server calls client method and code as asked @me-no-dev

* server calls client method and code as asked by @me-no-dev

* Changed Code presentation

* Added printf_P methods
2016-05-15 03:00:33 +03:00
Charles 1d275900eb Prevent Buffer Overflow and Added FlashStringHelper for text and binary (#26)
* Prevent buffer overflow on received data

* pass to 7 char to avoid save to flash by SDK

* return _contentLength, avoid array reparse to know len

* Added FlashStringHelper for text and binary

* Added FlashStringHelper also to AsyncWebSocketClient

* Added PROGMEM doc

* Corrected binary was sending PSTR as text, addded len

* Server calls client method and code as asked @me-no-dev

* server calls client method and code as asked by @me-no-dev

* Changed Code presentation
2016-05-12 15:17:35 +03:00
Charles b1492fc213 avoid client ID being 0
Prevent having clientID set to 0
When managing an array of different clientID, it's preferable to a valid
client not having it's ID set to 0
2016-05-06 16:54:15 +02:00
Me No Dev 8dfd328627 quiet debug and add access to the AsyncClient and it's IP/Port 2016-05-03 04:49:51 +03:00
Me No Dev 59732a09bd add proper credits 2016-04-23 17:20:51 +03:00
Me No Dev 3c3f38e6f6 fix printf eating the last charecter 2016-04-23 16:11:57 +03:00
Me No Dev 8d67809acf Add AsyncWebSocket plugin 2016-04-23 15:11:32 +03:00