Skip to content
This repository has been archived by the owner on Jan 29, 2023. It is now read-only.

Commit

Permalink
v1.0.6
Browse files Browse the repository at this point in the history
### New in v1.0.6

1. Add ***non-blocking WebSockets Server*** feature to enable WS Server and WebServer running ***concurently***. See [***Support as Http server and the Websockets server on Arduino DUE***](khoih-prog/WebSockets_Generic#1) and [***Running Http and Websocket Servers concurrently***](#1). Thanks to bug report and persistence of [Jake](https://github.com/jakespeed1311).
2. Add non-blocking WebSockets Server and WebServer examples. 
3. Add Ethernet Library Patches
4. Add Arduino SAMD Packages_Patches to fix compiler errors when using [Standard Template Library STL](https://en.wikipedia.org/wiki/Standard_Template_Library)
  • Loading branch information
khoih-prog authored Aug 6, 2020
1 parent 7d24223 commit 2011e39
Show file tree
Hide file tree
Showing 47 changed files with 414 additions and 99 deletions.
160 changes: 141 additions & 19 deletions README.md

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions keywords.txt
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ streamBinary KEYWORD2
end KEYWORD2
setFragmentsPolicy KEYWORD2
getFragmentsPolicy KEYWORD2
readNonBlocking KEYWORD2
readBlocking KEYWORD2
ping KEYWORD2
pong KEYWORD2
Expand Down
2 changes: 1 addition & 1 deletion library.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "WebSockets2_Generic",
"version": "1.0.5",
"version": "1.0.6",
"description": "WebSocket Server and Client for Arduino based on RFC6455, originally designed for ESP8266/ESP32, now modified and ported to run on nRF52, SAMD21/SAMD51, SAM DUE, STM32F/L/H/G/WB/MP1, etc. boards, with WiFiNINA, Ethernet W5x00/ENC28J60/LAN8742A, ESP8266/ESP32-AT modules/shields, as well as SINRIC / Alexa / Google Home",
"keywords": "wifi, http, web, server, client, websocket, ethernet, Sinric, Alexa",
"authors": [
Expand Down
2 changes: 1 addition & 1 deletion library.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name=WebSockets2_Generic
version=1.0.5
version=1.0.6
author=Gil Maimon <mail.gilmaimon@gmail.com>, Khoi Hoang <khoih.prog@gmail.com>
maintainer=Khoi Hoang <khoih.prog@gmail.com>
sentence=A library for writing modern Websockets applications with Arduino. Now support ESP8266, ESP32, nRF52, SAMD21, SAMD51, SAM DUE, STM32F/L/H/G/WB/MP1, etc. boards, with WiFiNINA, Ethernet W5x00/ENC28J60/LAN8742A, ESP8266/ESP32-AT modules/shields, as well as SINRIC / Alexa / Google Home
Expand Down
7 changes: 6 additions & 1 deletion src/Tiny_Websockets_Generic/client.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
Built by Khoi Hoang https://github.com/khoih-prog/Websockets2_Generic
Licensed under MIT license
Version: 1.0.5
Version: 1.0.6
Version Modified By Date Comments
------- ----------- ---------- -----------
Expand All @@ -21,6 +21,7 @@
1.0.4 K Hoang 27/07/2020 Add support to STM32F/L/H/G/WB/MP1 and Seeeduino SAMD21/SAMD51 using
Ethernet W5x00, ENC28J60, LAN8742A and WiFiNINA. Add examples and Packages' Patches.
1.0.5 K Hoang 29/07/2020 Sync with ArduinoWebsockets v0.4.18 to fix ESP8266 SSL bug.
1.0.6 K Hoang 06/08/2020 Add non-blocking WebSocketsServer feature and non-blocking examples.
*****************************************************************************************************************************/

#ifndef _CLIENT_HPP_
Expand Down Expand Up @@ -119,6 +120,10 @@ namespace websockets2_generic
void setFragmentsPolicy(const FragmentsPolicy newPolicy);
FragmentsPolicy getFragmentsPolicy() const;

// KH add in v1.0.6
WebsocketsMessage readNonBlocking();
//////

WebsocketsMessage readBlocking();

bool ping(const WSInterfaceString data = "");
Expand Down
3 changes: 2 additions & 1 deletion src/Tiny_Websockets_Generic/internals/data_frame.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
Built by Khoi Hoang https://github.com/khoih-prog/Websockets2_Generic
Licensed under MIT license
Version: 1.0.5
Version: 1.0.6
Version Modified By Date Comments
------- ----------- ---------- -----------
Expand All @@ -21,6 +21,7 @@
1.0.4 K Hoang 27/07/2020 Add support to STM32F/L/H/G/WB/MP1 and Seeeduino SAMD21/SAMD51 using
Ethernet W5x00, ENC28J60, LAN8742A and WiFiNINA. Add examples and Packages' Patches.
1.0.5 K Hoang 29/07/2020 Sync with ArduinoWebsockets v0.4.18 to fix ESP8266 SSL bug.
1.0.6 K Hoang 06/08/2020 Add non-blocking WebSocketsServer feature and non-blocking examples.
*****************************************************************************************************************************/

#pragma once
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
Built by Khoi Hoang https://github.com/khoih-prog/Websockets2_Generic
Licensed under MIT license
Version: 1.0.5
Version: 1.0.6
Version Modified By Date Comments
------- ----------- ---------- -----------
Expand All @@ -21,6 +21,7 @@
1.0.4 K Hoang 27/07/2020 Add support to STM32F/L/H/G/WB/MP1 and Seeeduino SAMD21/SAMD51 using
Ethernet W5x00, ENC28J60, LAN8742A and WiFiNINA. Add examples and Packages' Patches.
1.0.5 K Hoang 29/07/2020 Sync with ArduinoWebsockets v0.4.18 to fix ESP8266 SSL bug.
1.0.6 K Hoang 06/08/2020 Add non-blocking WebSocketsServer feature and non-blocking examples.
*****************************************************************************************************************************/

#pragma once
Expand Down
3 changes: 2 additions & 1 deletion src/Tiny_Websockets_Generic/internals/ws_common.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
Built by Khoi Hoang https://github.com/khoih-prog/Websockets2_Generic
Licensed under MIT license
Version: 1.0.5
Version: 1.0.6
Version Modified By Date Comments
------- ----------- ---------- -----------
Expand All @@ -21,6 +21,7 @@
1.0.4 K Hoang 27/07/2020 Add support to STM32F/L/H/G/WB/MP1 and Seeeduino SAMD21/SAMD51 using
Ethernet W5x00, ENC28J60, LAN8742A and WiFiNINA. Add examples and Packages' Patches.
1.0.5 K Hoang 29/07/2020 Sync with ArduinoWebsockets v0.4.18 to fix ESP8266 SSL bug.
1.0.6 K Hoang 06/08/2020 Add non-blocking WebSocketsServer feature and non-blocking examples.
*****************************************************************************************************************************/

#pragma once
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
Built by Khoi Hoang https://github.com/khoih-prog/Websockets2_Generic
Licensed under MIT license
Version: 1.0.5
Version: 1.0.6
Version Modified By Date Comments
------- ----------- ---------- -----------
Expand All @@ -21,6 +21,7 @@
1.0.4 K Hoang 27/07/2020 Add support to STM32F/L/H/G/WB/MP1 and Seeeduino SAMD21/SAMD51 using
Ethernet W5x00, ENC28J60, LAN8742A and WiFiNINA. Add examples and Packages' Patches.
1.0.5 K Hoang 29/07/2020 Sync with ArduinoWebsockets v0.4.18 to fix ESP8266 SSL bug.
1.0.6 K Hoang 06/08/2020 Add non-blocking WebSocketsServer feature and non-blocking examples.
*****************************************************************************************************************************/

#pragma once
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
Built by Khoi Hoang https://github.com/khoih-prog/Websockets2_Generic
Licensed under MIT license
Version: 1.0.5
Version: 1.0.6
Version Modified By Date Comments
------- ----------- ---------- -----------
Expand All @@ -21,6 +21,7 @@
1.0.4 K Hoang 27/07/2020 Add support to STM32F/L/H/G/WB/MP1 and Seeeduino SAMD21/SAMD51 using
Ethernet W5x00, ENC28J60, LAN8742A and WiFiNINA. Add examples and Packages' Patches.
1.0.5 K Hoang 29/07/2020 Sync with ArduinoWebsockets v0.4.18 to fix ESP8266 SSL bug.
1.0.6 K Hoang 06/08/2020 Add non-blocking WebSocketsServer feature and non-blocking examples.
*****************************************************************************************************************************/

#pragma once
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
Built by Khoi Hoang https://github.com/khoih-prog/Websockets2_Generic
Licensed under MIT license
Version: 1.0.5
Version: 1.0.6
Version Modified By Date Comments
------- ----------- ---------- -----------
Expand All @@ -21,6 +21,7 @@
1.0.4 K Hoang 27/07/2020 Add support to STM32F/L/H/G/WB/MP1 and Seeeduino SAMD21/SAMD51 using
Ethernet W5x00, ENC28J60, LAN8742A and WiFiNINA. Add examples and Packages' Patches.
1.0.5 K Hoang 29/07/2020 Sync with ArduinoWebsockets v0.4.18 to fix ESP8266 SSL bug.
1.0.6 K Hoang 06/08/2020 Add non-blocking WebSocketsServer feature and non-blocking examples.
*****************************************************************************************************************************/

#pragma once
Expand Down
3 changes: 2 additions & 1 deletion src/Tiny_Websockets_Generic/internals/ws_common_WiFiNINA.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
Built by Khoi Hoang https://github.com/khoih-prog/Websockets2_Generic
Licensed under MIT license
Version: 1.0.5
Version: 1.0.6
Version Modified By Date Comments
------- ----------- ---------- -----------
Expand All @@ -21,6 +21,7 @@
1.0.4 K Hoang 27/07/2020 Add support to STM32F/L/H/G/WB/MP1 and Seeeduino SAMD21/SAMD51 using
Ethernet W5x00, ENC28J60, LAN8742A and WiFiNINA. Add examples and Packages' Patches.
1.0.5 K Hoang 29/07/2020 Sync with ArduinoWebsockets v0.4.18 to fix ESP8266 SSL bug.
1.0.6 K Hoang 06/08/2020 Add non-blocking WebSocketsServer feature and non-blocking examples.
*****************************************************************************************************************************/

#pragma once
Expand Down
3 changes: 2 additions & 1 deletion src/Tiny_Websockets_Generic/internals/wscrypto/crypto.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
Built by Khoi Hoang https://github.com/khoih-prog/Websockets2_Generic
Licensed under MIT license
Version: 1.0.5
Version: 1.0.6
Version Modified By Date Comments
------- ----------- ---------- -----------
Expand All @@ -21,6 +21,7 @@
1.0.4 K Hoang 27/07/2020 Add support to STM32F/L/H/G/WB/MP1 and Seeeduino SAMD21/SAMD51 using
Ethernet W5x00, ENC28J60, LAN8742A and WiFiNINA. Add examples and Packages' Patches.
1.0.5 K Hoang 29/07/2020 Sync with ArduinoWebsockets v0.4.18 to fix ESP8266 SSL bug.
1.0.6 K Hoang 06/08/2020 Add non-blocking WebSocketsServer feature and non-blocking examples.
*****************************************************************************************************************************/

#pragma once
Expand Down
3 changes: 2 additions & 1 deletion src/Tiny_Websockets_Generic/internals/wscrypto/sha1.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
Built by Khoi Hoang https://github.com/khoih-prog/Websockets2_Generic
Licensed under MIT license
Version: 1.0.5
Version: 1.0.6
Version Modified By Date Comments
------- ----------- ---------- -----------
Expand All @@ -21,6 +21,7 @@
1.0.4 K Hoang 27/07/2020 Add support to STM32F/L/H/G/WB/MP1 and Seeeduino SAMD21/SAMD51 using
Ethernet W5x00, ENC28J60, LAN8742A and WiFiNINA. Add examples and Packages' Patches.
1.0.5 K Hoang 29/07/2020 Sync with ArduinoWebsockets v0.4.18 to fix ESP8266 SSL bug.
1.0.6 K Hoang 06/08/2020 Add non-blocking WebSocketsServer feature and non-blocking examples.
*****************************************************************************************************************************/

#pragma once
Expand Down
3 changes: 2 additions & 1 deletion src/Tiny_Websockets_Generic/message.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
Built by Khoi Hoang https://github.com/khoih-prog/Websockets2_Generic
Licensed under MIT license
Version: 1.0.5
Version: 1.0.6
Version Modified By Date Comments
------- ----------- ---------- -----------
Expand All @@ -21,6 +21,7 @@
1.0.4 K Hoang 27/07/2020 Add support to STM32F/L/H/G/WB/MP1 and Seeeduino SAMD21/SAMD51 using
Ethernet W5x00, ENC28J60, LAN8742A and WiFiNINA. Add examples and Packages' Patches.
1.0.5 K Hoang 29/07/2020 Sync with ArduinoWebsockets v0.4.18 to fix ESP8266 SSL bug.
1.0.6 K Hoang 06/08/2020 Add non-blocking WebSocketsServer feature and non-blocking examples.
*****************************************************************************************************************************/

#ifndef _MESSAGE_HPP_
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
Built by Khoi Hoang https://github.com/khoih-prog/Websockets2_Generic
Licensed under MIT license
Version: 1.0.5
Version: 1.0.6
Version Modified By Date Comments
------- ----------- ---------- -----------
Expand All @@ -21,6 +21,7 @@
1.0.4 K Hoang 27/07/2020 Add support to STM32F/L/H/G/WB/MP1 and Seeeduino SAMD21/SAMD51 using
Ethernet W5x00, ENC28J60, LAN8742A and WiFiNINA. Add examples and Packages' Patches.
1.0.5 K Hoang 29/07/2020 Sync with ArduinoWebsockets v0.4.18 to fix ESP8266 SSL bug.
1.0.6 K Hoang 06/08/2020 Add non-blocking WebSocketsServer feature and non-blocking examples.
*****************************************************************************************************************************/

#pragma once
Expand Down Expand Up @@ -122,15 +123,24 @@ namespace websockets2_generic
}

TcpClient* accept() override
{
{
while (available())
{
yield();
auto client = server.available();

if (client)
if (client)
{
return new EthernetTcpClient{client};
}
// KH, from v1.0.6, add to enable non-blocking when no WS Client
else
{
// Return NULL Client. Remember to test for NULL and process correctly
return NULL;
}
}

return new EthernetTcpClient;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
Built by Khoi Hoang https://github.com/khoih-prog/Websockets2_Generic
Licensed under MIT license
Version: 1.0.5
Version: 1.0.6
Version Modified By Date Comments
------- ----------- ---------- -----------
Expand All @@ -21,6 +21,7 @@
1.0.4 K Hoang 27/07/2020 Add support to STM32F/L/H/G/WB/MP1 and Seeeduino SAMD21/SAMD51 using
Ethernet W5x00, ENC28J60, LAN8742A and WiFiNINA. Add examples and Packages' Patches.
1.0.5 K Hoang 29/07/2020 Sync with ArduinoWebsockets v0.4.18 to fix ESP8266 SSL bug.
1.0.6 K Hoang 06/08/2020 Add non-blocking WebSocketsServer feature and non-blocking examples.
*****************************************************************************************************************************/

#pragma once
Expand Down Expand Up @@ -118,15 +119,24 @@ namespace websockets2_generic
}

TcpClient* accept() override
{
{
while (available())
{
yield();
auto client = server.available();

if (client)
if (client)
{
return new EthernetTcpClient{client};
}
// KH, from v1.0.6, add to enable non-blocking when no WS Client
else
{
// Return NULL Client. Remember to test for NULL and process correctly
return NULL;
}
}

return new EthernetTcpClient;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
Built by Khoi Hoang https://github.com/khoih-prog/Websockets2_Generic
Licensed under MIT license
Version: 1.0.5
Version: 1.0.6
Version Modified By Date Comments
------- ----------- ---------- -----------
Expand All @@ -21,6 +21,7 @@
1.0.4 K Hoang 27/07/2020 Add support to STM32F/L/H/G/WB/MP1 and Seeeduino SAMD21/SAMD51 using
Ethernet W5x00, ENC28J60, LAN8742A and WiFiNINA. Add examples and Packages' Patches.
1.0.5 K Hoang 29/07/2020 Sync with ArduinoWebsockets v0.4.18 to fix ESP8266 SSL bug.
1.0.6 K Hoang 06/08/2020 Add non-blocking WebSocketsServer feature and non-blocking examples.
*****************************************************************************************************************************/

#pragma once
Expand Down Expand Up @@ -126,15 +127,24 @@ namespace websockets2_generic
}

TcpClient* accept() override
{
{
while (available())
{
yield();
auto client = server.available();

if (client)
if (client)
{
return new EthernetTcpClient{client};
}
// KH, from v1.0.6, add to enable non-blocking when no WS Client
else
{
// Return NULL Client. Remember to test for NULL and process correctly
return NULL;
}
}

return new EthernetTcpClient;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
Built by Khoi Hoang https://github.com/khoih-prog/Websockets2_Generic
Licensed under MIT license
Version: 1.0.5
Version: 1.0.6
Version Modified By Date Comments
------- ----------- ---------- -----------
Expand All @@ -21,6 +21,7 @@
1.0.4 K Hoang 27/07/2020 Add support to STM32F/L/H/G/WB/MP1 and Seeeduino SAMD21/SAMD51 using
Ethernet W5x00, ENC28J60, LAN8742A and WiFiNINA. Add examples and Packages' Patches.
1.0.5 K Hoang 29/07/2020 Sync with ArduinoWebsockets v0.4.18 to fix ESP8266 SSL bug.
1.0.6 K Hoang 06/08/2020 Add non-blocking WebSocketsServer feature and non-blocking examples.
*****************************************************************************************************************************/

#pragma once
Expand Down Expand Up @@ -122,15 +123,24 @@ namespace websockets2_generic
}

TcpClient* accept() override
{
{
while (available())
{
yield();
auto client = server.available();

if (client)
if (client)
{
return new EthernetTcpClient{client};
}
// KH, from v1.0.6, add to enable non-blocking when no WS Client
else
{
// Return NULL Client. Remember to test for NULL and process correctly
return NULL;
}
}

return new EthernetTcpClient;
}

Expand Down
Loading

0 comments on commit 2011e39

Please sign in to comment.