Page 1 of 1

New WebSockets2_Generic Library. Now supporting STM32F/L/H/G/WB/MP1,nRF52, SAMD, DUE, etc

Posted: Sun Jul 19, 2020 5:48 am
by khoih-prog
https://github.com/khoih-prog/WebSockets2_Generic

How To Install Using Arduino Library Manager

Current Release

Why do we need this WebSockets2_Generic

This WebSockets2_Generic is based on and modified from Gil Maimon's ArduinoWebSockets Library to provide support to many more boards, such as Arduino SAMD21, Adafruit SAMD21/SAMD51, nRF52, STM32, Teensy, SAM DUE, etc. and enable those boards to use WebSockets services, including voice-control Alexa along with Blynk. Those supported boards can also run WebSockets Server. The WebSockets can be used with ESP’s WiFi, WiFiNINA, W5x00/ENC28J60/LAN8742A Ethernet, ESP8266/ESP32-AT modules/shields.

New in v1.0.3

1. Add support to STM32F boards with built-in Ethernet such as :
- Nucleo-144 (F429ZI, F767ZI)
- Discovery (STM32F746G-DISCOVERY)
- All STM32 Boards with Built-in Ethernet LAN8742A

2. Add support to STM32F1,2,3,4,7 boards (with 64+K Flash) using Ethernet W5x00, ENC28J60 or LAN8742A
3. Add Packages' Patches to Adafruit nRF52, SAMD, Arduino SAMD to enable displaying BOARD_NAME
4. Enhance examples and update README.md

New in v1.0.2

1. Add support to Ethernet ENC28J60, using UIPEthernet library. for nRF52, SAMD21/SAMD51 and SAM DUE boards.

New in v1.0.1

1. Add support to SAM DUE boards.
2. Add support to Ethernet W5x00, using either Ethernet, EthernetLarge or Ethernet2 library.
3. Restructure code to provide flexibility to support many more WiFi/Ethernet modules/shields in the future. Please delete the *.cpp files, replaced by *.hpp files, in the src directory, if *.cpp files still exist after installing new version.

New in v1.0.0

1. Add support to nRF52 boards, such as AdaFruit Feather nRF52832, nRF52840 Express, BlueFruit Sense, Itsy-Bitsy nRF52840 Express, Metro nRF52840 Express, NINA_B302_ublox, NINA_B112_ublox, etc..
2. Add support to SAMD51 (Itsy-Bitsy M4, Metro M4, Grand Central M4, Feather M4 Express, etc.).
3. Add support to SAMD21 (ZERO, MKR, NANO_33_IOT, M0, M0 Pro, AdaFruit CIRCUITPLAYGROUND_EXPRESS, etc.).
4. Add Alexa / SINRIC examples and supports to those boards as well as ESP8266/ESP32


Supported features of RFC6455

- text frame
- binary frame
- connection close
- ping
- pong
- continuation frame


1. This is the terminal output when running STM32-Ethernet-Client_SINRIC example on Nucleo-144 NUCLEO_F767ZI:

Code: Select all

Starting WebSockets2_Generic STM32-Ethernet-Client_SINRIC on NUCLEO_F767ZI
Ethernet using LAN8742A and STM32Ethernet Library
[SETUP] BOOT WAIT 4
[SETUP] BOOT WAIT 3
[SETUP] BOOT WAIT 2
[SETUP] BOOT WAIT 1
WebSockets Client IP address: 192.168.2.135
Connecting to WebSockets Server @iot.sinric.com
[WS] WebsocketsClient::generateHandshake: base64Authorization = ********
[WS] WebsocketsClient::generateHandshake: handshake = GET / HTTP/1.1
Host: iot.sinric.com
Sec-WebSocket-Key: ********
apikey: 11111111-2222-3333-4444-555555555555
Upgrade: websocket
Connection: Upgrade
Sec-WebSocket-Version: 13
User-Agent: TinyWebsockets Client
Authorization: Basic ********
Origin: https://github.com/khoih-prog/Websockets2_Generic

[WS] WebsocketsClient::connect: base64Authorization = ********
[WS] WebsocketsClient::doestStartsWith: str = HTTP/1.1 101 Switching Protocols

[WS] WebsocketsClient::doestStartsWith: prefix = HTTP/1.1 101
[WS] WebsocketsClient::generateHandshake: key = Server
[WS] WebsocketsClient::generateHandshake: value = nginx/1.10.3 (Ubuntu)
[WS] WebsocketsClient::generateHandshake: key = Date
[WS] WebsocketsClient::generateHandshake: value = Sat, 18 Jul 2020 06:42:54 GMT
[WS] WebsocketsClient::generateHandshake: key = Connection
[WS] WebsocketsClient::generateHandshake: value = upgrade
[WS] WebsocketsClient::generateHandshake: key = Upgrade
[WS] WebsocketsClient::generateHandshake: value = websocket
[WS] WebsocketsClient::generateHandshake: key = Sec-WebSocket-Accept
[WS] WebsocketsClient::generateHandshake: value = ********
Connected!
Got Message: {"deviceId":"012345678901234567890123","action":"setPowerState","value":"ON"}
Turn on device id: 012345678901234567890123
Got Message: {"deviceId":"012345678901234567890123","action":"setPowerState","value":"OFF"}
Turn off Device ID: 012345678901234567890123
2. This is terminal debug output when running STM32-Ethernet-Server on NUCLEO_F767ZI using built-in LAN8742A Ethernet module and STM32Ethernet Library , and receiving WebSockets connection from an NRF52840_ITSYBITSY_EXPRESS and an ESP8266 board.

Code: Select all

Starting WebSockets2_Generic STM32-Ethernet-Server on NUCLEO_F767ZI
Ethernet using LAN8742A and STM32Ethernet Library
[SETUP] BOOT WAIT 2
[SETUP] BOOT WAIT 1
WebSockets Server Running and Ready on NUCLEO_F767ZI
IP address: 192.168.2.95, Port: 8080
H[WS] WebsocketsServer::recvHandshakeRequest: value = 192.168.2.95
[WS] WebsocketsServer::recvHandshakeRequest: value = ********
[WS] WebsocketsServer::recvHandshakeRequest: value = websocket
[WS] WebsocketsServer::recvHandshakeRequest: value = Upgrade
[WS] WebsocketsServer::recvHandshakeRequest: value = 13
[WS] WebsocketsServer::recvHandshakeRequest: value = TinyWebsockets Client
[WS] WebsocketsServer::recvHandshakeRequest: value = Basic 
[WS] WebsocketsServer::recvHandshakeRequest: value = https://github.com/khoih-prog/Websockets2_Generic
Got Message: Hello to Server from ESP8266
[WS] WebsocketsServer::recvHandshakeRequest: value = 192.168.2.95
[WS] WebsocketsServer::recvHandshakeRequest: value = ********
[WS] WebsocketsServer::recvHandshakeRequest: value = websocket
[WS] WebsocketsServer::recvHandshakeRequest: value = Upgrade
[WS] WebsocketsServer::recvHandshakeRequest: value = 13
[WS] WebsocketsServer::recvHandshakeRequest: value = TinyWebsockets Client
[WS] WebsocketsServer::recvHandshakeRequest: value = Basic 
[WS] WebsocketsServer::recvHandshakeRequest: value = https://github.com/khoih-prog/Websockets2_Generic
Got Message: Echo: Hello to Server from NRF52840_ITSYBITSY_EXPRESS
3. This is terminal debug output when running STM32-Ethernet-Client on Nucleo-144 NUCLEO_F767ZI board with Ethernet LAN8742A shield using STM32Ethernet library

Code: Select all

Starting WebSockets2_Generic STM32-Ethernet-Client on NUCLEO_F767ZI
Ethernet using LAN8742A and STM32Ethernet Library
WebSockets Client IP address: 192.168.2.133
Connecting to WebSockets Server @192.168.2.95
[WS] WebsocketsClient::generateHandshake: base64Authorization = 
[WS] WebsocketsClient::generateHandshake: handshake = GET / HTTP/1.1
Host: 192.168.2.95
Sec-WebSocket-Key: ********
Upgrade: websocket
Connection: Upgrade
Sec-WebSocket-Version: 13
User-Agent: TinyWebsockets Client
Authorization: Basic 
Origin: https://github.com/khoih-prog/Websockets2_Generic

[WS] WebsocketsClient::connect: base64Authorization = 
[WS] WebsocketsClient::doestStartsWith: str = HTTP/1.1 101 Switching Protocols

[WS] WebsocketsClient::doestStartsWith: prefix = HTTP/1.1 101
[WS] WebsocketsClient::generateHandshake: key = Connection
[WS] WebsocketsClient::generateHandshake: value = Upgrade
[WS] WebsocketsClient::generateHandshake: key = Upgrade
[WS] WebsocketsClient::generateHandshake: value = websocket
[WS] WebsocketsClient::generateHandshake: key = Sec-WebSocket-Version
[WS] WebsocketsClient::generateHandshake: value = 13
[WS] WebsocketsClient::generateHandshake: key = Sec-WebSocket-Accept
[WS] WebsocketsClient::generateHandshake: value = ********
Connnection Opened
Connected!
Got Message: Echo: Hello to Server from NUCLEO_F767ZI
Connnection Closed

Re: New WebSockets2_Generic Library. Now supporting nRF52, SAMD, DUE, STM32F/L/H/G/WB/MP1, etc

Posted: Tue Jul 28, 2020 4:54 pm
by khoih-prog
New in v1.0.4

1. Add support to all STM32F/L/H/G/WB/MP1 (Nucleo-144 NUCLEO_F767ZI, Nucleo-64 NUCLEO_L053R8, etc.)
2. Add support to Seeeduino SAMD21/SAMD51 boards (SEEED_WIO_TERMINAL, SEEED_FEMTO_M0, SEEED_XIAO_M0, Wio_Lite_MG126, WIO_GPS_BOARD, SEEEDUINO_ZERO, SEEEDUINO_LORAWAN, SEEED_GROVE_UI_WIRELESS, etc.)
3. Add sample Packages_Patches for STM32 stm32 (Nucleo-144 NUCLEO_F767ZI, Nucleo-64 NUCLEO_L053R8)
4. Add Packages' Patches for Seeeduino SAMD to enable displaying BOARD_NAME
5. Add many examples, especially for STM32F/L/H/G/WB/MP1

Re: New WebSockets2_Generic Library. Now supporting STM32F/L/H/G/WB/MP1,nRF52, SAMD, DUE, etc

Posted: Thu Aug 06, 2020 5:52 am
by khoih-prog
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 and Running Http and Websocket Servers concurrently. Thanks to bug report and persistence of Jake.
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


Image


New in v1.0.5

1. Sync with ArduinoWebsockets v0.4.18 to fix ESP8266 SSL bug.