WebSockets_Generic
WebSockets_Generic copied to clipboard
WebSocket / Socket.IO Server and Client for Arduino based on RFC6455. Now supporting Adafruit nRF52, Portenta_H7, STM32F/L/H/G/WB/MP1, Teensy, SAM DUE, SAMD21, SAMD51, Arduino SAMD21 (Nano 33 IoT), MK...
WebSockets_Generic
Table of Contents
- Important notes about Portenta_H7 Ethernet
-
Why do we need this WebSockets_Generic library
- Features
- Supported features of RFC6455
- Important Notes
- Currently supported Boards
- Currently supported WiFi shields/modules
- Currently supported Ethernet shields/modules
- Changelog
- Prerequisites
-
Installation
- Use Arduino Library Manager
- Manual Install
- VS Code & PlatformIO
-
Installation
- Use Arduino Library Manager
- Manual Install
- VS Code & PlatformIO
-
Packages' Patches
- 1. For Adafruit nRF52840 and nRF52832 boards
- 2. For Teensy boards
- 3. For Arduino SAM DUE boards
-
4. For Arduino SAMD boards
- For core version v1.8.10+
- For core version v1.8.9-
- 5. For Adafruit SAMD boards
- 6. For Seeeduino SAMD boards
-
7. For STM32 boards
- 7.1. For STM32 boards to use LAN8720
- 7.2. For STM32 boards to use Serial1
-
8. For RP2040-based boards using Earle Philhower arduino-pico core
- 8.1. To use BOARD_NAME
- 8.2. To avoid compile error relating to microsecondsToClockCycles
- 9. For Portenta_H7 boards using Arduino IDE in Linux
- 10. For RTL8720DN boards using AmebaD core
-
Libraries' Patches
- 1. For application requiring 2K+ HTML page
- 2. For Ethernet library
- 3. For EthernetLarge library
- 4. For Etherne2 library
- 5. For Ethernet3 library
- 6. For UIPEthernet library
- 7. For fixing ESP32 compile error
- 8. For fixing ESP8266 compile error
- HOWTO Use analogRead() with ESP32 running WiFi and/or BlueTooth (BT/BLE)
-
Important Notes
- Limitations
- Limitations for Async
- Originally Supported Hardware
- wss / SSL
- ESP Async TCP
- How to use
- High Level Client API
-
Examples
- For Generic boards using W5x00 Ethernet shield
- For Generic boards using WiFiNINA
- For Generic boards using ENC28J60 Ethernet shield and EthernetENC library
- For WiFiNINA
- For WiFi101
- For W5x00 Ethernet shield
- For ENC28J60 Ethernet shield using UIPEthernet library
- For ESP32 board
- For ESP8266 board
- For SeeedStudio WIO Terminal using Realtek RTL8720DN WiFi
- For STM32 boards using built-in LAN8742A Ethernet
- For Teensy boards using ENC28J60 Ethernet shield and EthernetENC library
- For Teensy 4.1 boards using NativeEthernet
- For Teensy boards using W5x00 Ethernet shield
- For Teensy boards using WiFiNINA
- For Teensy 4.1 boards using QNEthernet
- Nodejs Socket.IO Test Server to use with examples
- For WT32_ETH01 board New
-
For Portenta_H7 board. New
- Portenta_Ethernet.
- WiFi
- For ESP8266 Async WebSocket. New
- Example Generic_WebSocketClient_WiFiNINA
-
Debug Terminal Output Samples
- 1. Generic_WebSocketClient_EthernetENC on NRF52840_FEATHER
- 2. Generic_Ethernet_Blinds on NRF52840_FEATHER with ENC28J60 using EthernetENC Library
- 3. WebSocketClientSocketIO_W5500 on NRF52840_FEATHER with W5500 using Ethernet_Generic Library
- 4. Generic_WebSocketClientSocketIO_EthernetENC on NRF52840_FEATHER with ENC28J60 using EthernetENC Library
- 5. WIOTerminal_WebSocketClientSSL on SeeedStudio SAMD51 WIO_TERMINAL with Realtek RTL8720DN WiFi using Seeed_Arduino_rpcWiFi Library
- 6. Generic_WebSocketClientSSL_WiFiNINA on Arduino SAMD21 Nano-33-IoT with WiFiNINA using WiFiNINA_Generic Library
-
7. WebSocketClientSocketIO_NINA on Arduino SAMD21 Nano-33-IoT with WiFiNINA using WiFiNINA_Generic Library
- 7.1 Client
- 7.2 Server
-
8. Generic_WebSocketClientSocketIO_W5500 on NRF52840_FEATHER with W5x00 using Ethernet_Generic Library
- 8.1 Client
- 8.2 Server
-
9. WebSocketClientSocketIO_W5500 on RASPBERRY_PI_PICO with W5x00 using Ethernet_Generic Library
- 9.1 Client
- 9.2 Server
-
10. WebSocketClientSocketIO_W5500 on MBED RASPBERRY_PI_PICO with W5x00 using Ethernet_Generic Library
- 10.1 Client
- 10.2 Server
-
11. WT32_ETH01_WebSocketClientSocketIO on WT32_ETH01
- 11.1 Client
- 11.2 Server
-
12. Teensy_WebSocketClientSocketIO_QNEthernet on TEENSY 4.1 using QNEthernet
- 12.1 Client
- 12.2 Server
-
13. Portenta_H7_WebSocketClientSocketIO on PORTENTA_H7_M7 with Ethernet
- 13.1 Client
- 13.2 Server
-
14. WebSocketClientSocketIO_WiFi on Portenta_H7 using WiFi
- 14.1 Client
- 14.2 Server
- 15. Portenta_H7_WebSocketClient_Sticky_SocketIO on PORTENTA_H7_M7 using Ethernet
- 16. ESP32_WebSocketClientSocketIO on ESP32S3_DEV New
- 17. ESP8266_AsyncWSClient on ESP8266_NODEMCU_ESP12E New
- Debug
- Troubleshooting
- Issues
- TO DO
- DONE
- Contributions and Thanks
- Contributing
- License and credits
Important notes about Portenta_H7 Ethernet
Portenta_H7 Ethernet doesn't work in mbed_portenta core v3.0.0, and has been fixed in core v3.0.1. Check [Portenta_H7] Ethernet not working in core v3.0.0 #436.
Please use mbed_portenta core v2.8.0- or v3.0.1+ for Portenta_H7 Ethernet.
Why do we need this WebSockets_Generic library
Features
Many Web services require WebSockets library, which is so far written only for ESP8266/ESP32 boards. The ESP boards rely on this Markus Sattler's WebSockets Library to connect to Alexa via Sinric or SinricPro skills.
This WebSockets_Generic library is a RFC6455-based WebSocket Server and Client for Arduino boards. It is based on and modified from Markus Sattler's WebSockets Library to provide support to many more boards, such as WT32_ETH01 (ESP32 + LAN8720), Arduino SAMD21, Adafruit SAMD21/SAMD51, nRF52, STM32F/L/H/G/WB/MP1, Teensy, SAM DUE, RP2040-based boards, 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, WiFi101, W5x00, ENC28J60 Ethernet and Teensy 4.1 NativeEthernet/QNEthernet.
Supported features of RFC6455
- text frame
- binary frame
- connection close
- ping
- pong
- continuation frame
Important Notes
- Currently, the WebSocketServer feature is usable only for ESP8266/ESP32 (ESP32, ESP32_S2, ESP32_S3 and ESP32_C3) and WT32_ETH01 (ESP32 + LAN8720).
- The timeline when to fix and reintroduce the WebSocketServer feature to other boards is not determined yet.
- Please use the new WebSockets2_Generic Library if WebSocketServer is necessary. See Issue 2, Issue 3 and Issue 4
Currently supported Boards
This WebSockets_Generic library currently supports these following boards:
-
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.
-
SAMD21
- Arduino SAMD21: ZERO, MKRs, NANO_33_IOT, etc.
- Adafruit SAMD21 (M0): ItsyBitsy M0, Feather M0, Feather M0 Express, Metro M0 Express, Circuit Playground Express, Trinket M0, PIRkey, Hallowing M0, Crickit M0, etc.
- Seeeduino: LoRaWAN, Zero, Femto M0, XIAO M0, Wio GPS Board, etc.
- SAMD51
- Adafruit SAMD51 (M4): Metro M4, Grand Central M4, ItsyBitsy M4, Feather M4 Express, Trellis M4, Metro M4 AirLift Lite, MONSTER M4SK Express, Hallowing M4, etc.
- Seeeduino: Wio Terminal, Grove UI Wireless
- SAM DUE
- Teensy (4.1, 4.0, 3.6, 3.5, 3,2, 3.1, 3.0)
- STM32F/L/H/G/WB/MP1 boards (with 32+K Flash)
- Nucleo-144
- Nucleo-64
- Discovery
- Generic STM32F0, STM32F1, STM32F2, STM32F3, STM32F4, STM32F7 (with 64+K Flash): x8 and up
- STM32L0, STM32L1, STM32L4
- STM32G0, STM32G4
- STM32H7
- STM32WB
- STM32MP1
- LoRa boards
- 3-D printer boards
- Generic Flight Controllers
- Midatronics boards
- ESP32
- ESP32 boards, such as
ESP32_DEV
, etc. - ESP32_S2-based boards, such as
ESP32S2_DEV
,ESP32_S2 Saola
, etc. - ESP32_C3-based boards, such as
ESP32C3_DEV
, etc. New - ESP32_S3 (ESP32S3_DEV, ESP32_S3_BOX, UM TINYS3, UM PROS3, UM FEATHERS3, etc.) New
-
ESP8266
-
RP2040-based boards, such as RASPBERRY_PI_PICO, ADAFRUIT_FEATHER_RP2040 and GENERIC_RP2040, using Arduino-mbed RP2040 v2.1.0+ core or Earle Philhower's arduino-pico core v1.5.1+.
-
WT32_ETH01 boards using ESP32-based boards and LAN8720 Ethernet
-
Portenta_H7 using either
Murata WiFi
orVision-shield Ethernet
Currently supported WiFi shields/modules
- WiFiNINA using
WiFiNINA_Generic library
- WiFi101 using
WiFi101 library v0.16.1+
- U-Blox W101, W102 using
WiFiNINA_Generic library
- ESP8266-AT command using
WiFiEspAT library
- ESP8266/ESP32-AT command using
ESP_AT_Lib library
andESP8266_AT_WebServer
- ESP32 and ESP8266 WiFi
- Portenta_H7 built-in Murata WiFi
Currently supported Ethernet shields/modules
- W5x00 using
Ethernet
,EthernetLarge
,Ethernet2
orEthernet3
library - ENC28J60 using
EthernetENC
orUIPEthernet
library - LAN8720 Ethernet used in WT32_ETH01 (ESP32 + LAN8720) boards
- Teensy 4.1 built-in Ethernet using
NativeEthernet
library - Teensy 4.1 built-in Ethernet using
QNEthernet
library - Portenta_H7 using Ethernet from Portenta Vision shields
Prerequisites
-
Arduino AVR core 1.8.5+
for Arduino (Use Arduino Board Manager) AVR boards. -
Teensy core v1.56+
for Teensy (4.1, 4.0, 3.6, 3.5, 3,2, 3.1, 3.0) boards. -
Arduino SAM DUE core v1.6.12+
for SAM DUE ARM Cortex-M3 boards. -
Arduino SAMD core 1.8.13+
for SAMD ARM Cortex-M0+ boards. -
Adafruit SAMD core 1.7.10+
for SAMD ARM Cortex-M0+ and M4 boards (Nano 33 IoT, etc.). -
Seeeduino SAMD core 1.8.2+
for SAMD21/SAMD51 boards (XIAO M0, Wio Terminal, etc.). -
Adafruit nRF52 v1.3.0+
for nRF52 boards such as Adafruit NRF52840_FEATHER, NRF52832_FEATHER, NRF52840_FEATHER_SENSE, NRF52840_ITSYBITSY, NRF52840_CIRCUITPLAY, NRF52840_CLUE, NRF52840_METRO, NRF52840_PCA10056, PARTICLE_XENON, NINA_B302_ublox, etc. -
ESP32 Core 2.0.2+
for ESP32-based boards. -
ESP8266 Core 3.0.2+
for ESP8266-based boards.. To use ESP8266 core 2.7.1+ for LittleFS.
-
ArduinoCore-mbed mbed_rp2040, mbed_nano, mbed_portenta core 3.0.1+
for Arduino (Use Arduino Board Manager) Portenta_H7, RP2040-based boards, such as Nano_RP2040_Connect, RASPBERRY_PI_PICO. -
Earle Philhower's arduino-pico core v1.13.1+
for RP2040-based boards such as RASPBERRY_PI_PICO, ADAFRUIT_FEATHER_RP2040 and GENERIC_RP2040, etc. -
Arduino Core for STM32 v2.2.0+
for STM32F/L/H/G/WB/MP1 boards. -
Arduino AmebaD core 3.1.2+
for Realtek RTL8720DN, RTL8722DM and RTL8722CSM. -
WiFiNINA_Generic library v1.8.14-3+
if for WiFiNINA. To install. check.
-
EthernetWebServer library v2.1.1+
if necessary to use Ethernet modules/shields. To install, check -
EthernetWebServer_STM32 library v1.4.0+
if necessary to use Ethernet modules/shields. To install, check -
WebServer_WT32_ETH01 library v1.4.1+
if necessary to use WT32_ETH01 boards. To install, check -
Depending on which Ethernet card you're using:
-
Ethernet_Generic library v2.0.0+
for W5100, W5200 and W5500/WIZ550io/WIZ850io/USR-ES1 with Wiznet W5500 chip. -
EthernetENC library v2.0.2+
for ENC28J60.. New and Better
-
UIPEthernet library v2.0.11+
for ENC28J60. -
STM32Ethernet library v1.2.0+
for built-in LAN8742A Ethernet on (Nucleo-144, Discovery).. To be used with
LwIP library v2.1.2+
..
-
NativeEthernet Library version stable111+
for Teensy 4.1 built-in Ethernet. -
QNEthernet Library version v0.13.0+
Teensy 4.1 built-in Ethernet. New
-
WiFiWebServer library v1.7.0+
if necessary to use certain WiFi/WiFiNINA features. To install, check -
FlashStorage_SAMD library v1.3.2+
for SAMD21 and SAMD51 boards (ZERO, MKR, NANO_33_IOT, M0, M0 Pro, AdaFruit Itsy-Bitsy M4, etc.) if necessary to use certain features. -
FlashStorage_STM32 library v1.2.0+
for STM32F/L/H/G/WB/MP1 boards.if necessary to use certain features.
-
DueFlashStorage library v1.0.0+
for SAM DUE if necessary to use certain features. To install, check.
-
Adafruit's LittleFS/InternalFS
for nRF52. Already included if you already installed Adafruit nRF52 board package from Boards Manager. -
DoubleResetDetector_Generic v1.8.1+
if necessary to use some examples. To install. checkif necessary to use certain features.
-
Modified WiFi101 Library v0.16.1+
to use SAMD MKR1000, etc. boards with WiFi101. -
SinricPro_Generic v2.8.4+
if necessary to use some examples. To install. checkif necessary to use certain features.
-
ESPAsyncTCP v1.2.2+
for ESP8266 Async.
Installation
Use Arduino Library Manager
The best and easiest way is to use Arduino Library Manager
. Search for WebSockets_Generic, then select / install the latest version.
You can also use this link for more detailed instructions.
Manual Install
Another way to install is to:
- Navigate to WebSockets_Generic page.
- Download the latest release
WebSockets_Generic-master.zip
. - Extract the zip file to
WebSockets_Generic-master
directory - Copy whole
WebSockets_Generic-master
folder to Arduino libraries' directory such as~/Arduino/libraries/
.
VS Code & PlatformIO:
- Install VS Code
- Install PlatformIO
- Install WebSockets_Generic library by using Library Manager. Search for WebSockets_Generic in Platform.io Author's Libraries
- Use included platformio.ini file from examples to ensure that all dependent libraries will installed automatically. Please visit documentation for the other options and examples at Project Configuration File
Packages' Patches
1. For Adafruit nRF52840 and nRF52832 boards
To be able to compile, run and automatically detect and display BOARD_NAME on nRF52840/nRF52832 boards, you have to copy the whole nRF52 Packages_Patches directory into Adafruit nRF52 directory (~/.arduino15/packages/adafruit/hardware/nrf52/1.3.0).
Supposing the Adafruit nRF52 version is 1.3.0. These files must be copied into the directory:
-
~/.arduino15/packages/adafruit/hardware/nrf52/1.3.0/platform.txt
-
~/.arduino15/packages/adafruit/hardware/nrf52/1.3.0/boards.txt
-
~/.arduino15/packages/adafruit/hardware/nrf52/1.3.0/cores/nRF5/Udp.h
-
~/.arduino15/packages/adafruit/hardware/nrf52/1.3.0/cores/nRF5/Print.h
-
~/.arduino15/packages/adafruit/hardware/nrf52/1.3.0/cores/nRF5/Print.cpp
-
~/.arduino15/packages/adafruit/hardware/nrf52/1.3.0/variants/NINA_B302_ublox/variant.h
-
~/.arduino15/packages/adafruit/hardware/nrf52/1.3.0/variants/NINA_B302_ublox/variant.cpp
-
~/.arduino15/packages/adafruit/hardware/nrf52/1.3.0/variants/NINA_B112_ublox/variant.h
-
~/.arduino15/packages/adafruit/hardware/nrf52/1.3.0/variants/NINA_B112_ublox/variant.cpp
-
~/.arduino15/packages/adafruit/hardware/nrf52/1.3.0/cores/nRF5/Udp.h
Whenever a new version is installed, remember to copy these files into the new version directory. For example, new version is x.yy.z These files must be copied into the directory:
-
~/.arduino15/packages/adafruit/hardware/nrf52/x.yy.z/platform.txt
-
~/.arduino15/packages/adafruit/hardware/nrf52/x.yy.z/boards.txt
-
~/.arduino15/packages/adafruit/hardware/nrf52/x.yy.z/cores/nRF5/Udp.h
-
~/.arduino15/packages/adafruit/hardware/nrf52/x.yy.z/cores/nRF5/Print.h
-
~/.arduino15/packages/adafruit/hardware/nrf52/x.yy.z/cores/nRF5/Print.cpp
-
~/.arduino15/packages/adafruit/hardware/nrf52/x.yy.z/variants/NINA_B302_ublox/variant.h
-
~/.arduino15/packages/adafruit/hardware/nrf52/x.yy.z/variants/NINA_B302_ublox/variant.cpp
-
~/.arduino15/packages/adafruit/hardware/nrf52/x.yy.z/variants/NINA_B112_ublox/variant.h
-
~/.arduino15/packages/adafruit/hardware/nrf52/x.yy.z/variants/NINA_B112_ublox/variant.cpp
-
~/.arduino15/packages/adafruit/hardware/nrf52/x.yy.z/cores/nRF5/Udp.h
2. For Teensy boards
To be able to compile and run on Teensy boards, you have to copy the files in Packages_Patches for Teensy directory into Teensy hardware directory (./arduino-1.8.19/hardware/teensy/avr/boards.txt).
Supposing the Arduino version is 1.8.19. These files must be copied into the directory:
-
./arduino-1.8.19/hardware/teensy/avr/boards.txt
-
./arduino-1.8.19/hardware/teensy/avr/cores/teensy/Stream.h
-
./arduino-1.8.19/hardware/teensy/avr/cores/teensy3/Stream.h
-
./arduino-1.8.19/hardware/teensy/avr/cores/teensy4/Stream.h
Whenever a new version is installed, remember to copy this file into the new version directory. For example, new version is x.yy.zz These files must be copied into the directory:
-
./arduino-x.yy.zz/hardware/teensy/avr/boards.txt
-
./arduino-x.yy.zz/hardware/teensy/avr/cores/teensy/Stream.h
-
./arduino-x.yy.zz/hardware/teensy/avr/cores/teensy3/Stream.h
-
./arduino-x.yy.zz/hardware/teensy/avr/cores/teensy4/Stream.h
3. For Arduino SAM DUE boards
To be able to compile and run on SAM DUE boards, you have to copy the whole SAM DUE directory into Arduino sam directory (~/.arduino15/packages/arduino/hardware/sam/1.6.12).
Supposing the Arduino SAM core version is 1.6.12. This file must be copied into the directory:
-
~/.arduino15/packages/arduino/hardware/sam/1.6.12/platform.txt
Whenever a new version is installed, remember to copy this file into the new version directory. For example, new version is x.yy.zz This file must be copied into the directory:
-
~/.arduino15/packages/arduino/hardware/sam/x.yy.zz/platform.txt
4. For Arduino SAMD boards
To be able to compile, run and automatically detect and display BOARD_NAME on Arduino SAMD (Nano-33-IoT, etc) boards, you have to copy the whole Arduino SAMD Packages_Patches directory into Arduino SAMD directory (~/.arduino15/packages/arduino/hardware/samd/1.8.12).
For core version v1.8.10+
Supposing the Arduino SAMD version is 1.8.12. Now only one file must be copied into the directory:
-
~/.arduino15/packages/arduino/hardware/samd/1.8.12/platform.txt
Whenever a new version is installed, remember to copy this files into the new version directory. For example, new version is x.yy.zz
This file must be copied into the directory:
-
~/.arduino15/packages/arduino/hardware/samd/x.yy.zz/platform.txt
For core version v1.8.9-
Supposing the Arduino SAMD version is 1.8.9. These files must be copied into the directory:
-
~/.arduino15/packages/arduino/hardware/samd/1.8.9/platform.txt
-
~/.arduino15/packages/arduino/hardware/samd/1.8.9/cores/arduino/Arduino.h
Whenever a new version is installed, remember to copy these files into the new version directory. For example, new version is x.yy.z
These files must be copied into the directory:
-
~/.arduino15/packages/arduino/hardware/samd/x.yy.z/platform.txt
-
~/.arduino15/packages/arduino/hardware/samd/x.yy.z/cores/arduino/Arduino.h
This is mandatory to fix the notorious Arduino SAMD compiler error. See Improve Arduino compatibility with the STL (min and max macro)
...\arm-none-eabi\include\c++\7.2.1\bits\stl_algobase.h:243:56: error: macro "min" passed 3 arguments, but takes just 2
min(const _Tp& __a, const _Tp& __b, _Compare __comp)
Whenever the above-mentioned compiler error issue is fixed with the new Arduino SAMD release, you don't need to copy the Arduino.h
file anymore.
5. For Adafruit SAMD boards
To be able to compile, run and automatically detect and display BOARD_NAME on Adafruit SAMD (Itsy-Bitsy M4, etc) boards, you have to copy the whole Adafruit SAMD Packages_Patches directory into Adafruit samd directory (~/.arduino15/packages/adafruit/hardware/samd/1.7.10).
Supposing the Adafruit SAMD core version is 1.7.10. This file must be copied into the directory:
-
~/.arduino15/packages/adafruit/hardware/samd/1.7.10/platform.txt
-
~/.arduino15/packages/adafruit/hardware/samd/1.7.10/cores/arduino/Print.h
-
~/.arduino15/packages/adafruit/hardware/samd/1.7.10/cores/arduino/Print.cpp
Whenever a new version is installed, remember to copy this file into the new version directory. For example, new version is x.yy.zz This file must be copied into the directory:
-
~/.arduino15/packages/adafruit/hardware/samd/x.yy.zz/platform.txt
-
~/.arduino15/packages/adafruit/hardware/samd/x.yy.zz/cores/arduino/Print.h
-
~/.arduino15/packages/adafruit/hardware/samd/x.yy.zz/cores/arduino/Print.cpp
6. For Seeeduino SAMD boards
Important Notes
Be sure to use the Packages_Patches
of WebSockets_Generic
library version v2.14.1+ to avoid compiler error.
To be able to compile, run and automatically detect and display BOARD_NAME on Seeeduino SAMD (XIAO M0, Wio Terminal, etc) boards, you have to copy the whole Seeeduino SAMD Packages_Patches directory into Seeeduino samd directory (~/.arduino15/packages/Seeeduino/hardware/samd/1.8.2).
Supposing the Seeeduino SAMD core version is 1.8.2. This file must be copied into the directory:
-
~/.arduino15/packages/Seeeduino/hardware/samd/1.8.2/platform.txt
-
~/.arduino15/packages/Seeeduino/hardware/samd/1.8.2/cores/arduino/Arduino.h
-
~/.arduino15/packages/Seeeduino/hardware/samd/1.8.2/cores/arduino/Print.h
-
~/.arduino15/packages/Seeeduino/hardware/samd/1.8.2/cores/arduino/Print.cpp
Whenever a new version is installed, remember to copy this file into the new version directory. For example, new version is x.yy.zz This file must be copied into the directory:
-
~/.arduino15/packages/Seeeduino/hardware/samd/x.yy.zz/platform.txt
-
~/.arduino15/packages/Seeeduino/hardware/samd/x.yy.zz/cores/arduino/Arduino.h
-
~/.arduino15/packages/Seeeduino/hardware/samd/x.yy.zz/cores/arduino/Print.h
-
~/.arduino15/packages/Seeeduino/hardware/samd/x.yy.zz/cores/arduino/Print.cpp
7. For STM32 boards
7.1 For STM32 boards to use LAN8720
To use LAN8720 on some STM32 boards
- Nucleo-144 (F429ZI, NUCLEO_F746NG, NUCLEO_F746ZG, NUCLEO_F756ZG)
- Discovery (DISCO_F746NG)
- STM32F4 boards (BLACK_F407VE, BLACK_F407VG, BLACK_F407ZE, BLACK_F407ZG, BLACK_F407VE_Mini, DIYMORE_F407VGT, FK407M1)
you have to copy the files stm32f4xx_hal_conf_default.h and stm32f7xx_hal_conf_default.h into STM32 stm32 directory (~/.arduino15/packages/STM32/hardware/stm32/2.2.0/system) to overwrite the old files.
Supposing the STM32 stm32 core version is 2.2.0. These files must be copied into the directory:
-
~/.arduino15/packages/STM32/hardware/stm32/2.2.0/system/STM32F4xx/stm32f4xx_hal_conf_default.h
for STM32F4. -
~/.arduino15/packages/STM32/hardware/stm32/2.2.0/system/STM32F7xx/stm32f7xx_hal_conf_default.h
for Nucleo-144 STM32F7.
Whenever a new version is installed, remember to copy this file into the new version directory. For example, new version is x.yy.zz, theses files must be copied into the corresponding directory:
-
~/.arduino15/packages/STM32/hardware/stm32/x.yy.zz/system/STM32F4xx/stm32f4xx_hal_conf_default.h
- `~/.arduino15/packages/STM32/hardware/stm32/x.yy.zz/system/STM32F7xx/stm32f7xx_hal_conf_default.h
7.2 For STM32 boards to use Serial1
To use Serial1 on some STM32 boards without Serial1 definition (Nucleo-144 NUCLEO_F767ZI, Nucleo-64 NUCLEO_L053R8, etc.) boards, you have to copy the files STM32 variant.h into STM32 stm32 directory (~/.arduino15/packages/STM32/hardware/stm32/2.2.0). You have to modify the files corresponding to your boards, this is just an illustration how to do.
Supposing the STM32 stm32 core version is 2.2.0. These files must be copied into the directory:
-
~/.arduino15/packages/STM32/hardware/stm32/2.2.0/variants/STM32F7xx/F765Z(G-I)T_F767Z(G-I)T_F777ZIT/NUCLEO_F767ZI/variant.h
for Nucleo-144 NUCLEO_F767ZI. -
~/.arduino15/packages/STM32/hardware/stm32/2.2.0/variants/STM32L0xx/L052R(6-8)T_L053R(6-8)T_L063R8T/NUCLEO_L053R8/variant.h
for Nucleo-64 NUCLEO_L053R8.
Whenever a new version is installed, remember to copy this file into the new version directory. For example, new version is x.yy.zz, theses files must be copied into the corresponding directory:
-
~/.arduino15/packages/STM32/hardware/stm32/x.yy.zz/variants/STM32F7xx/F765Z(G-I)T_F767Z(G-I)T_F777ZIT/NUCLEO_F767ZI/variant.h
-
~/.arduino15/packages/STM32/hardware/stm32/x.yy.zz/variants/STM32L0xx/L052R(6-8)T_L053R(6-8)T_L063R8T/NUCLEO_L053R8/variant.h
8. For RP2040-based boards using Earle Philhower arduino-pico core
8.1 To use BOARD_NAME
To be able to automatically detect and display BOARD_NAME on RP2040-based boards (RASPBERRY_PI_PICO, ADAFRUIT_FEATHER_RP2040, GENERIC_RP2040, etc) boards, you have to copy the file RP2040 platform.txt into rp2040 directory (~/.arduino15/packages/rp2040/hardware/rp2040/1.4.0).
Supposing the rp2040 core version is 1.4.0. This file must be copied into the directory:
-
~/.arduino15/packages/rp2040/hardware/rp2040/1.4.0/platform.txt
Whenever a new version is installed, remember to copy this file into the new version directory. For example, new version is x.yy.zz This file must be copied into the directory:
-
~/.arduino15/packages/rp2040/hardware/rp2040/x.yy.zz/platform.txt
With core after v1.5.0, this step is not necessary anymore thanks to the PR Add -DBOARD_NAME="{build.board}" #136.
8.2 To avoid compile error relating to microsecondsToClockCycles
Some libraries, such as Adafruit DHT-sensor-library, require the definition of microsecondsToClockCycles(). To be able to compile and run on RP2040-based boards, you have to copy the files in RP2040 Arduino.h into rp2040 directory (~/.arduino15/packages/rp2040/hardware/rp2040/1.4.0).
Supposing the rp2040 core version is 1.4.0. This file must be copied to replace:
-
~/.arduino15/packages/rp2040/hardware/rp2040/1.4.0/cores/rp2040/Arduino.h
Whenever a new version is installed, remember to copy this file into the new version directory. For example, new version is x.yy.zz This file must be copied to replace:
-
~/.arduino15/packages/rp2040/hardware/rp2040/x.yy.zz/cores/rp2040/Arduino.h
With core after v1.5.0, this step is not necessary anymore thanks to the PR Add defs for compatibility #142.
9. For Portenta_H7 boards using Arduino IDE in Linux
To be able to upload firmware to Portenta_H7 using Arduino IDE in Linux (Ubuntu, etc.), you have to copy the file portenta_post_install.sh into mbed_portenta directory (~/.arduino15/packages/arduino/hardware/mbed_portenta/3.0.1/portenta_post_install.sh).
Then run the following command using sudo
$ cd ~/.arduino15/packages/arduino/hardware/mbed_portenta/3.0.1
$ chmod 755 portenta_post_install.sh
$ sudo ./portenta_post_install.sh
This will create the file /etc/udev/rules.d/49-portenta_h7.rules
as follows:
# Portenta H7 bootloader mode UDEV rules
SUBSYSTEMS=="usb", ATTRS{idVendor}=="2341", ATTRS{idProduct}=="035b", GROUP="plugdev", MODE="0666"
Supposing the ArduinoCore-mbed core version is 3.0.1. Now only one file must be copied into the directory:
-
~/.arduino15/packages/arduino/hardware/mbed_portenta/3.0.1/portenta_post_install.sh
Whenever a new version is installed, remember to copy this files into the new version directory. For example, new version is x.yy.zz
This file must be copied into the directory:
-
~/.arduino15/packages/arduino/hardware/mbed_portenta/x.yy.zz/portenta_post_install.sh
10. For RTL8720DN boards using AmebaD core
To avoid compile error relating to PROGMEM, you have to copy the file Realtek AmebaD core pgmspace.h into Realtek AmebaD directory (~/.arduino15/packages/realtek/hardware/AmebaD/3.1.2/cores/arduino/avr/pgmspace.h).
Supposing the Realtek AmebaD core version is 3.1.2. This file must be copied into the directory:
-
~/.arduino15/packages/realtek/hardware/AmebaD/3.1.2/cores/arduino/avr/pgmspace.h
Whenever a new version is installed, remember to copy this file into the new version directory. For example, new version is x.yy.zz This file must be copied into the directory:
-
~/.arduino15/packages/realtek/hardware/AmebaD/x.yy.zz/cores/arduino/avr/pgmspace.h
Libraries' Patches
1. For application requiring 2K+ HTML page
If your application requires 2K+ HTML page, the current Ethernet library
must be modified if you are using W5200/W5500 Ethernet shields. W5100 is not supported for 2K+ buffer. If you use boards requiring different CS/SS pin for W5x00 Ethernet shield, for example ESP32, ESP8266, nRF52, etc., you also have to modify the following libraries to be able to specify the CS/SS pin correctly.
2. For Ethernet library
To fix Ethernet library
, just copy these following files into the Ethernet library
directory to overwrite the old files:
- Ethernet.h
- Ethernet.cpp
- EthernetServer.cpp
- w5100.h
- w5100.cpp
You can also use the forked and modified library at Patched Ethernet
3. For EthernetLarge library
To fix EthernetLarge library
, just copy these following files into the EthernetLarge library
directory to overwrite the old files:
- EthernetLarge.h
- EthernetLarge.cpp
- EthernetServer.cpp
- w5100.h
- w5100.cpp
You can also use the forked and modified library at Patched EthernetLarge
4. For Ethernet2 library
To fix Ethernet2 library
, just copy these following files into the Ethernet2 library
directory to overwrite the old files:
- Ethernet2.h
- Ethernet2.cpp
To add UDP Multicast support, necessary for the UPnP_Generic library:
- EthernetUdp2.h
- EthernetUdp2.cpp
You can also use the forked and modified library at Patched Ethernet2
5. For Ethernet3 library
- To fix
Ethernet3 library
, just copy these following files into theEthernet3 library
directory to overwrite the old files:
- Ethernet3.h
- Ethernet3.cpp
You can also use the forked and modified library at Patched Ethernet3
6. For UIPEthernet library
To be able to compile and run on nRF52 boards with ENC28J60 using UIPEthernet library, you have to copy these following files into the UIPEthernet utility
directory to overwrite the old files:
- UIPEthernet.h
- UIPEthernet.cpp
- Enc28J60Network.h
- Enc28J60Network.cpp
7. For fixing ESP32 compile error
To fix ESP32 compile error
, just copy the following file into the ESP32
cores/esp32 directory (e.g. ./arduino-1.8.13/hardware/espressif/cores/esp32) to overwrite the old file:
- Server.h
8. For fixing ESP8266 compile error
To fix ESP8266 compile error
such as
error: 'class EthernetClass' has no member named 'init'
Ethernet.init (USE_THIS_SS_PIN);
just rename the following file in ./arduino-1.8.13/hardware/esp8266com/esp8266/libraries/Ethernet directory
- From
Ethernet.h
toEthernet_ESP8266.h
HOWTO Use analogRead() with ESP32 running WiFi and/or BlueTooth (BT/BLE)
Please have a look at ESP_WiFiManager Issue 39: Not able to read analog port when using the autoconnect example to have more detailed description and solution of the issue.
1. ESP32 has 2 ADCs, named ADC1 and ADC2
2. ESP32 ADCs functions
- ADC1 controls ADC function for pins GPIO32-GPIO39
- ADC2 controls ADC function for pins GPIO0, 2, 4, 12-15, 25-27
3.. ESP32 WiFi uses ADC2 for WiFi functions
Look in file adc_common.c
In ADC2, there're two locks used for different cases:
lock shared with app and Wi-Fi: ESP32: When Wi-Fi using the ADC2, we assume it will never stop, so app checks the lock and returns immediately if failed. ESP32S2: The controller's control over the ADC is determined by the arbiter. There is no need to control by lock.
lock shared between tasks: when several tasks sharing the ADC2, we want to guarantee all the requests will be handled. Since conversions are short (about 31us), app returns the lock very soon, we use a spinlock to stand there waiting to do conversions one by one.
adc2_spinlock should be acquired first, then adc2_wifi_lock or rtc_spinlock.
- In order to use ADC2 for other functions, we have to acquire complicated firmware locks and very difficult to do
- So, it's not advisable to use ADC2 with WiFi/BlueTooth (BT/BLE).
- Use ADC1, and pins GPIO32-GPIO39
- If somehow it's a must to use those pins serviced by ADC2 (GPIO0, 2, 4, 12, 13, 14, 15, 25, 26 and 27), use the fix mentioned at the end of ESP_WiFiManager Issue 39: Not able to read analog port when using the autoconnect example to work with ESP32 WiFi/BlueTooth (BT/BLE).
Important Notes
-
Code is restructured to provide flexibility to make it easy 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.
-
For Adafruit nRF52, use the SPI's pin as follows:
- SS/CS = 10
- SPI_MOSI = MO(SI)
- SPI_MISO = MI(SO)
- SPI_SCK = SCK
- For Adafruit SAMD21/SAMD51, use the SPI's CS/SS pin as follows:
- Itsy-Bitsy M0/M4, Feather M0 (Express), Hallowing M0 Express, Zero, Metro M0 => use CS = 16 = pin A2
- Feather M4 (SAMD51) => use SS/CS = 9
- Grand Central M4 => use SS/CS = 53
- Hallowing M4 => use SS/CS = 10
- Metro M4 AirLift => use SS/CS = 36
To know the default CS/SS pins of not listed boards, check the related variant.h
files in
~/.arduino15/packages/adafruit/hardware/samd/x.y.zz/variants/board_name/variant.h
- For Arduino SAM DUE, use the SPI's pin as follows:
- SS/CS = 10
- SPI_MOSI = 75 ( pin 4 @ ICSP connector )
- SPI_MISO = 74 ( pin 1 @ ICSP connector )
- SPI_SCK = 76 ( pin 3 @ ICSP connector )
Limitations
- max input length is limited to the ram size and the
WEBSOCKETS_MAX_DATA_SIZE
define - max output length has no limit (the hardware is the limit)
- Client send big frames with mask 0x00000000 (on AVR all frames)
- continuation frame reassembly need to be handled in the application code
Limitations for Async
- Functions called from within the context of the websocket event might not honor
yield()
and/ordelay()
. See this issue for more info and a potential workaround. - wss / SSL is not possible.
wss / SS
supported for:
- wss client on the ESP8266
- wss / SSL is not natively supported in WebSocketsServer. However it is possible to achieve secure websockets by running the device behind an SSL proxy. See Nginx for a sample Nginx server configuration file to enable this.
ESP Async TCP
This libary can run in Async TCP mode on the ESP.
The mode can be activated in the WebSockets_Generic.h (see WEBSOCKETS_NETWORK_TYPE define).
ESPAsyncTCP library is required.
How to use
In your code, select one of the currently supported network connection from the following list:
- NETWORK_ESP8266_ASYNC for ESP8266 Async
- NETWORK_W5100 for W5x00 Ethernet
- NETWORK_ENC28J60 for ENC28J60 Ethernet using UIPEthernet library
- NETWORK_ESP32 for ESP32 WiFi
- NETWORK_ESP32_ETH for ESP32 Ethernet
- NETWORK_WIFININA for WiFiNINA
- NETWORK_ETHERNET_ENC for ENC28J60 Ethernet using EthernetENC library
-
NETWORK_RTL8720DN for NETWORK_RTL8720DN Ethernet using
Seeed_Arduino_rpcWiFi
andSeeed_Arduino_rpcUnified
libraries - NETWORK_NATIVEETHERNET for Teeensy 4.1 NativeEthernet
- NETWORK_LAN8742A for STM32 with LAN8742A Ethernet using STM32Ethernet library
- NETWORK_WIFI101 for SAMD_MKR1000 and SAMD_MKRWIFI1010 using WiFi101 library
- NETWORK_QN_ETHERNET for Teeensy 4.1 built-in Ethernet using QNEthernet Library
-
NETWORK_PORTENTA_H7_WIFI for Portenta_H7 using
Murata
WiFi - NETWORK_PORTENTA_H7_ETHERNET for Portenta_H7 using Vision-shield Ethernet
then add #define WEBSOCKETS_NETWORK_TYPE
before #include <WebSocketsClient_Generic.h>
For example:
#define WEBSOCKETS_NETWORK_TYPE NETWORK_WIFININA
#include <WebSocketsClient_Generic.h>
High Level Client API
-
begin
: Initiate connection sequence to the WebSocket host.
void begin(const char * host, uint16_t port, const char * url = "/", const char * protocol = "arduino");
void begin(String host, uint16_t port, String url = "/", String protocol = "arduino");
void begin(IPAddress host, uint16_t port, const char * url = "/", const char * protocol = "arduino");
void begin(IPAddress host, uint16_t port, String url = "/", String protocol = "arduino");
-
beginSSL
: Initiate SSL connection sequence to the WebSocket host.
#if defined(HAS_SSL)
#ifdef SSL_AXTLS
void beginSSL(const char * host, uint16_t port, const char * url = "/", const char * fingerprint = "", const char * protocol = "arduino");
void beginSSL(IPAddress host, uint16_t port, String url = "/", String fingerprint = "", String protocol = "arduino");
void beginSSL(String host, uint16_t port, String url = "/", String fingerprint = "", String protocol = "arduino");
#else
void beginSSL(const char * host, uint16_t port, const char * url = "/", const uint8_t * fingerprint = NULL, const char * protocol = "arduino");
void beginSSL(IPAddress host, uint16_t port, String url = "/", String fingerprint = "", String protocol = "arduino");
void beginSslWithCA(const char * host, uint16_t port, const char * url = "/", BearSSL::X509List * CA_cert = NULL, const char * protocol = "arduino");
#endif // SSL_AXTLS
void beginSslWithCA(const char * host, uint16_t port, const char * url = "/", const char * CA_cert = NULL, const char * protocol = "arduino");
#endif // HAS_SSL
-
beginSocketIO
: Initiate connection sequence to the WebSocketIO host.
void beginSocketIO(const char * host, uint16_t port, const char * url = "/socket.io/?EIO=3", const char * protocol = "arduino");
void beginSocketIO(String host, uint16_t port, String url = "/socket.io/?EIO=3", String protocol = "arduino");
void beginSocketIO(IPAddress host, uint16_t port, String url = "/socket.io/?EIO=3", String protocol = "arduino");
-
onEvent
: Callback to handle for websocket events
void onEvent(WebSocketClientEvent cbEvent);
-
WebSocketClientEvent
: Handler for websocket events
void (*WebSocketClientEvent)(WStype_t type, uint8_t * payload, size_t length)
Where WStype_t type
is defined as:
typedef enum
{
WStype_ERROR,
WStype_DISCONNECTED,
WStype_CONNECTED,
WStype_TEXT,
WStype_BIN,
WStype_FRAGMENT_TEXT_START,
WStype_FRAGMENT_BIN_START,
WStype_FRAGMENT,
WStype_FRAGMENT_FIN,
WStype_PING,
WStype_PONG,
} WStype_t;
Examples
For Generic boards using W5x00 Ethernet shield
- Generic_WebSocketClientSocketIO_W5500
- Generic_WebSocketClientStompOverSockJs_W5500
- Generic_WebSocketClientStomp_W5500
- Generic_WebSocketClient_W5500.
- Generic_WebSocketServerAllFunctionsDemo_W5500
- Generic_WebSocketServerFragmentation_W5500
- Generic_WebSocketServerHttpHeaderValidation_W5500
- Generic_WebSocketServer_LEDcontrol_W5500
- Generic_WebSocketServer_W5500
For Generic boards using WiFiNINA
- Generic_WebSocketClientSocketIO_WiFiNINA
- Generic_WebSocketClientStompOverSockJs_WiFiNINA
- Generic_WebSocketClientStomp_WiFiNINA
- Generic_WebSocketClient_WiFiNINA.
- Generic_WebSocketServerAllFunctionsDemo_WiFiNINA
- Generic_WebSocketServerFragmentation_WiFiNINA
- Generic_WebSocketServerHttpHeaderValidation_WiFiNINA
- Generic_WebSocketServer_LEDcontrol_WiFiNINA
- Generic_WebSocketServer_WiFiNINA
- Generic_WebSocketClientSSL_WiFiNINA.
For Generic boards using ENC28J60 Ethernet shield and EthernetENC library
- Generic_WebSocketClientSocketIO_EthernetENC
- Generic_WebSocketClientStompOverSockJs_EthernetENC
- Generic_WebSocketClientStomp_EthernetENC
- Generic_WebSocketClient_EthernetENC.
- Generic_WebSocketServerAllFunctionsDemo_EthernetENC
- Generic_WebSocketServerFragmentation_EthernetENC
- Generic_WebSocketServerHttpHeaderValidation_EthernetENC
- Generic_WebSocketServer_LEDcontrol_EthernetENC
- Generic_WebSocketServer_EthernetENC
For WiFiNINA
- WebSocketClient_NINA.
- WebSocketClientSocketIO_NINA
- WebSocketClientStomp_NINA
- WebSocketClientStompOverSockJs_NINA
- WebSocketClientSSL_NINA
- WebSocketClient_Sticky_SocketIO_NINA. New
For WiFi101
- WebSocketClient_WiFi101.
- WebSocketClientSocketIO_WiFi101
- WebSocketClientStomp_WiFi101
- WebSocketClientStompOverSockJs_WiFi101
- WebSocketClientSSL_WiFi101.
For W5x00 Ethernet shield
- WebSocketClient_W5500.
- WebSocketClientSocketIO_W5500
- WebSocketClientStomp_W5500
- WebSocketClientStompOverSockJs_W5500
- WebSocketClient_Sticky_SocketIO_W5500. New
For ENC28J60 Ethernet shield using UIPEthernet library
- WebSocketClient_ENC.
- WebSocketClientSocketIO_ENC
- WebSocketClientStomp_ENC
- WebSocketClientStompOverSockJs_ENC
For ESP32 board
- ESP32_WebSocketClient
- ESP32_WebSocketClientSocketIO New
- ESP32_WebSocketClientSSL
- ESP32_WebSocketServer
For ESP8266 board
- ESP8266_WebSocketClient.
- ESP8266_WebSocketClientSocketIO
- ESP8266_WebSocketClientSocketIOack
- ESP8266_WebSocketClientSSL.
- ESP8266_WebSocketClientStomp
- ESP8266_WebSocketClientStompOverSockJs
- ESP8266_WebSocketServer
- ESP8266_WebSocketServerAllFunctionsDemo
- ESP8266_WebSocketServerFragmentation
- ESP8266_WebSocketServerHttpHeaderValidation
- ESP8266_WebSocketServer_LEDcontrol
- ESP8266_WebSocketClient_Sticky_SocketIO New
- ESP8266_WebSocketClientOTA New
For SeeedStudio WIO Terminal using Realtek RTL8720DN WiFi
- WIOTerminal_WebSocketClient
- WIOTerminal_WebSocketClientSSL.
- WIOTerminal_WebSocketServer
For STM32 boards using built-in LAN8742A Ethernet
- STM32_WebSocketClient_LAN8742A
- STM32_WebSocketClientSocketIO_LAN8742A
- STM32_WebSocketClientStomp_LAN8742A
- STM32_WebSocketClientStompOverSockJs_LAN8742A
- STM32_WebSocketServerAllFunctionsDemo_LAN8742A
- STM32_WebSocketServerFragmentation_LAN8742A
- STM32_WebSocketServerHttpHeaderValidation_LAN8742A
- STM32_WebSocketServer_LAN8742A
- STM32_WebSocketServer_LEDcontrol_LAN8742A
For Teensy boards using ENC28J60 Ethernet shield and EthernetENC library
- Teensy_WebSocketClientSocketIO_EthernetENC
- Teensy_WebSocketClientStompOverSockJs_EthernetENC
- Teensy_WebSocketClientStomp_EthernetENC
- Teensy_WebSocketClient_EthernetENC.
- Teensy_WebSocketServerAllFunctionsDemo_EthernetENC
- Teensy_WebSocketServerFragmentation_EthernetENC
- Teensy_WebSocketServerHttpHeaderValidation_EthernetENC
- Teensy_WebSocketServer_LEDcontrol_EthernetENC
- Teensy_WebSocketServer_EthernetENC
For Teensy 4.1 boards using NativeEthernet
- Teensy_WebSocketClient_NativeEthernet
- Teensy_WebSocketClientStompOverSockJs_NativeEthernet
- Teensy_WebSocketClientStomp_NativeEthernet
- Teensy_WebSocketClient_NativeEthernet.
- Teensy_WebSocketServerAllFunctionsDemo_NativeEthernet
- Teensy_WebSocketServerFragmentation_NativeEthernet
- Teensy_WebSocketServerHttpHeaderValidation_NativeEthernet
- Teensy_WebSocketServer_LEDcontrol_NativeEthernet
- Teensy_WebSocketServer_NativeEthernet
For Teensy boards using W5x00 Ethernet shield
- Teensy_WebSocketClientSocketIO_W5500
- Teensy_WebSocketClientStompOverSockJs_W5500
- Teensy_WebSocketClientStomp_W5500
- Teensy_WebSocketClient_W5500.
- Teensy_WebSocketServerAllFunctionsDemo_W5500
- Teensy_WebSocketServerFragmentation_W5500
- Teensy_WebSocketServerHttpHeaderValidation_W5500
- Teensy_WebSocketServer_LEDcontrol_W5500
- Teensy_WebSocketServer_W5500
For Teensy boards using WiFiNINA
- Teensy_WebSocketClientSocketIO_WiFiNINA
- Teensy_WebSocketClientStompOverSockJs_WiFiNINA
- Teensy_WebSocketClientStomp_WiFiNINA
- Teensy_WebSocketClient_WiFiNINA.
- Teensy_WebSocketServerAllFunctionsDemo_WiFiNINA
- Teensy_WebSocketServerFragmentation_WiFiNINA
- Teensy_WebSocketServerHttpHeaderValidation_WiFiNINA
- Teensy_WebSocketServer_LEDcontrol_WiFiNINA
- Teensy_WebSocketServer_WiFiNINA
- Teensy_WebSocketClientSSL_WiFiNINA.
For Teensy 4.1 boards using QNEthernet
- Teensy_WebSocketClient_QNEthernet
- Teensy_WebSocketClientSocketIO_QNEthernet
- Teensy_WebSocketServerAllFunctionsDemo_QNEthernet
- Teensy_WebSocketServerFragmentation_QNEthernet
- Teensy_WebSocketServerHttpHeaderValidation_QNEthernet
- Teensy_WebSocketServer_LEDcontrol_QNEthernet
- Teensy_WebSocketServer_QNEthernet
Nodejs Socket.IO Test Server to use with examples
- app.js
- SIO_server.sh
- HOWTO.md
- package.json
- package-lock.json
Nodejs_Sticky_SocketIO_TestServer to use with examples
- Multi_Sticky_SIO.js
- Multi_Sticky_SIO_server.sh
- HOWTO.md
- package.json
- package-lock.json
For WT32_ETH01 board
- WT32_ETH01_WebSocketClient.
- WT32_ETH01_WebSocketClientSocketIO
- WT32_ETH01_WebSocketClientSSL
- WT32_ETH01_WebSocketServer
- WT32_ETH01_WebSocketClient_Sticky_SocketIO. New
- WT32_ETH01_SSL_SIO. New
For Portenta_H7 board
Portenta_Ethernet
- Portenta_H7_WebSocketClient.
- Portenta_H7_WebSocketClientSocketIO
- Portenta_H7_WebSocketClient_Sticky_SocketIO. New
WiFi
- WebSocketClientSocketIO_WiFi
- WebSocketClient_WiFi
- WebSocketClient_Sticky_SocketIO_WiFi. New
For ESP8266 Async WebSocket
- ESP8266_AsyncWSClient New
Example Generic_WebSocketClient_WiFiNINA
https://github.com/khoih-prog/WebSockets_Generic/blob/cb5740fa01ed6fd460f3b4dc851cc072da1ed1f6/examples/Generic/WiFiNINA/Generic_WebSocketClient_WiFiNINA/Generic_WebSocketClient_WiFiNINA.ino#L18-L212
Debug Terminal Output Samples
1. Generic_WebSocketClient_EthernetENC on NRF52840_FEATHER
Start Generic_WebSocketClient_EthernetENC on NRF52840_FEATHER
WebSockets_Generic v2.15.0
[WS] Board : NRF52840_FEATHER , setCsPin: 10
[WS] Default SPI pinout:
[WS] MOSI: 25
[WS] MISO: 24
[WS] SCK: 26
[WS] SS: 5
[WS] =========================
WebSockets Client @ IP address: 192.168.2.93
Connecting to WebSockets Server @ IP address: 192.168.2.140
[WS] [WS-Client][handleHeader] RX: HTTP/1.1 101 Switching Protocols
[WS] [WS-Client][handleHeader] RX: Server: arduino-WebSocketsServer
[WS] [WS-Client][handleHeader] RX: Upgrade: websocket
[WS] [WS-Client][handleHeader] RX: Connection: Upgrade
[WS] [WS-Client][handleHeader] RX: Sec-WebSocket-Version: 13
[WS] [WS-Client][handleHeader] RX: Sec-WebSocket-Accept: PJIpSp/QBZPtgaA5LIeNbtWz710=
[WS] [WS-Client][handleHeader] RX: Sec-WebSocket-Protocol: arduino
[WS] [WS-Client][handleHeader] Header read fin.
[WS] [WS-Client][handleHeader] Client settings:
[WS] [WS-Client][handleHeader] - cURL: /
[WS] [WS-Client][handleHeader] - cKey: XAtxzzeVt0HiQZ3cu85Y3A==
[WS] [WS-Client][handleHeader] Server header:
[WS] [WS-Client][handleHeader] - cCode: 101
[WS] [WS-Client][handleHeader] - cIsUpgrade: 1
[WS] [WS-Client][handleHeader] - cIsWebsocket: 1
[WS] [WS-Client][handleHeader] - cAccept: PJIpSp/QBZPtgaA5LIeNbtWz710=
[WS] [WS-Client][handleHeader] - cProtocol: arduino
[WS] [WS-Client][handleHeader] - cExtensions:
[WS] [WS-Client][handleHeader] - cVersion: 13
[WS] [WS-Client][handleHeader] - cSessionId:
[WSc] Connected to url: /
[WSc] get text: Connected
2. Generic_Ethernet_Blinds on NRF52840_FEATHER with ENC28J60 using EthernetENC Library
You can see the NRF52840_FEATHER board, with ENC28J60 using EthernetENC Library, connects to SinricPro service using SinricPro_Generic library.
It also uses this WebSockets_Generic library to communicate with SinricPro service, to control Blinds via the Sinric Pro
phone APP
Starting Generic_Ethernet_Blinds on NRF52840_FEATHER with ENC28J60 using EthernetENC Library
[SRP] =========================
[SRP] Default SPI pinout:
[SRP] MOSI: 25
[SRP] MISO: 24
[SRP] SCK: 26
[SRP] SS: 5
[SRP] =========================
[SRP] Use default CS/SS pin : 10
Index = 6
Connected!
[Ethernet]: IP-Address is 192.168.2.97
[SRP] Creating new device. No current DeviceId = 123456789012345678901234
[SRP] add(): Adding DeviceId = 123456789012345678901234
[SRP] begin(): App-Key = 12345678-1234-1234-1234-123456789012
[SRP] begin(): App-Secret = 12345678-1234-1234-1234-123456789012-12345678-1234-1234-1234-123456789012
[SRP] Websocket: Connecting to WebSocket Server: ws.sinric.pro
Websocket: headers:
appkey:12345678-1234-1234-1234-123456789012
deviceids:123456789012345678901234
restoredevicestates:false
platform:NRF52840_FEATHER
version:2.8.4
Connected to SinricPro
[SRP] handleReceiveQueue(): Message(s) in receiveQueue = 1
[SRP] handleReceiveQueue(): Valid Signature. Processing message...
[SRP] extractTimestamp(): Got Timestamp = 1602031564
[SRP] handleReceiveQueue(): Message(s) in receiveQueue = 1
[SRP] handleReceiveQueue(): Valid Signature. Processing message...
[SRP] extractTimestamp(): Got Timestamp = 1602031575
[SRP] handleRequest(): handling request
{
"header": {
"payloadVersion": 2,
"signatureVersion": 1
},
"payload": {
"action": "setPowerState",
"clientId": "sinricpro-web",
"createdAt": 1602031575,
"deviceAttributes": [],
"deviceId": "123456789012345678901234",
"replyToken": "4a2080b4-ca92-4fb7-aec1-3aa8d108a818",
"type": "request",
"value": {
"state": "Off"
}
},
"signature": {
"HMAC": "PttsGuF4w4xfwzJHA6C5WDOmQmBgHXv9eTMSg8hYHXM="
}
}
Device 123456789012345678901234 power turned off
[SRP] handleSendQueue(): Sending Number of Message(s) in sendQueue = 1
{
"header": {
"payloadVersion": 2,
"signatureVersion": 1
},
"payload": {
"action": "setPowerState",
"clientId": "sinricpro-web",
"createdAt": 1602031575,
"deviceId": "123456789012345678901234",
"message": "OK",
"replyToken": "4a2080b4-ca92-4fb7-aec1-3aa8d108a818",
"success": true,
"type": "response",
"value": {
"state": "Off"
}
},
"signature": {
"HMAC": "42vn7js8X+KvuHHPZSrGeJt7dtwP8VVl9Y3cZsYtXOA="
}
}
[SRP] handleSendQueue: Sending to WebSocket
[SRP] handleSendQueue(): Message sent.
[SRP] handleReceiveQueue(): Message(s) in receiveQueue = 1
[SRP] handleReceiveQueue(): Valid Signature. Processing message...
[SRP] extractTimestamp(): Got Timestamp = 1602031577
[SRP] handleRequest(): handling request
{
"header": {
"payloadVersion": 2,
"signatureVersion": 1
},
"payload": {
"action": "setPowerState",
"clientId": "sinricpro-web",
"createdAt": 1602031577,
"deviceAttributes": [],
"deviceId": "123456789012345678901234",
"replyToken": "81a2433d-957d-481e-a9f7-2dea5c2e6c78",
"type": "request",
"value": {
"state": "On"
}
},
"signature": {
"HMAC": "ir18LAhlUVCWHY5hA8QdGY8bzHE/s4XBeX8cwHTaPQI="
}
}
Device 123456789012345678901234 power turned on
[SRP] handleSendQueue(): Sending Number of Message(s) in sendQueue = 1
{
"header": {
"payloadVersion": 2,
"signatureVersion": 1
},
"payload": {
"action": "setPowerState",
"clientId": "sinricpro-web",
"createdAt": 1602031577,
"deviceId": "123456789012345678901234",
"message": "OK",
"replyToken": "81a2433d-957d-481e-a9f7-2dea5c2e6c78",
"success": true,
"type": "response",
"value": {
"state": "On"
}
},
"signature": {
"HMAC": "9Z1uVUjeaCf1T2Ol6Fv4wXkz8gaJvEYmmIRfRcDnOgA="
}
}
[SRP] handleSendQueue: Sending to WebSocket
[SRP] handleSendQueue(): Message sent.
[SRP] handleReceiveQueue(): Message(s) in receiveQueue = 1
[SRP] handleReceiveQueue(): Valid Signature. Processing message...
[SRP] extractTimestamp(): Got Timestamp = 1602031578
[SRP] handleRequest(): handling request
{
"header": {
"payloadVersion": 2,
"signatureVersion": 1
},
"payload": {
"action": "setRangeValue",
"clientId": "sinricpro-web",
"createdAt": 1602031578,
"deviceAttributes": [],
"deviceId": "123456789012345678901234",
"replyToken": "16d6fd59-dfd1-4017-ab51-ff8bb85fc806",
"type": "request",
"value": {
"rangeValue": 100
}
},
"signature": {
"HMAC": "KfAwQ6z5XGvoZaspBVBP+CXnryW0YsEILqyxesHDhJo="
}
}
Device 123456789012345678901234 set position to 100
[SRP] handleSendQueue(): Sending Number of Message(s) in sendQueue = 1
{
"header": {
"payloadVersion": 2,
"signatureVersion": 1
},
"payload": {
"action": "setRangeValue",
"clientId": "sinricpro-web",
"createdAt": 1602031578,
"deviceId": "123456789012345678901234",
"message": "OK",
"replyToken": "16d6fd59-dfd1-4017-ab51-ff8bb85fc806",
"success": true,
"type": "response",
"value": {
"rangeValue": 100
}
},
"signature": {
"HMAC": "CNYG9Or+ZH+R2S1Ouvd2bqX8lT/8Siu23T8LycZVtTk="
}
}
[SRP] handleSendQueue: Sending to WebSocket
[SRP] handleSendQueue(): Message sent.
[SRP] handleReceiveQueue(): Message(s) in receiveQueue = 1
[SRP] handleReceiveQueue(): Valid Signature. Processing message...
[SRP] extractTimestamp(): Got Timestamp = 1602031579
[SRP] handleRequest(): handling request
{
"header": {
"payloadVersion": 2,
"signatureVersion": 1
},
"payload": {
"action": "setRangeValue",
"clientId": "sinricpro-web",
"createdAt": 1602031579,
"deviceAttributes": [],
"deviceId": "123456789012345678901234",
"replyToken": "864b1a6b-d539-49e0-bad8-48fa27d80d7f",
"type": "request",
"value": {
"rangeValue": 0
}
},
"signature": {
"HMAC": "8CsQ57297F9lzrKBopsE8Xga2RdT9pgJpA8moGQFBTs="
}
}
Device 123456789012345678901234 set position to 0
[SRP] handleSendQueue(): Sending Number of Message(s) in sendQueue = 1
{
"header": {
"payloadVersion": 2,
"signatureVersion": 1
},
"payload": {
"action": "setRangeValue",
"clientId": "sinricpro-web",
"createdAt": 1602031579,
"deviceId": "123456789012345678901234",
"message": "OK",
"replyToken": "864b1a6b-d539-49e0-bad8-48fa27d80d7f",
"success": true,
"type": "response",
"value": {
"rangeValue": 0
}
},
"signature": {
"HMAC": "AF7bO1deIYIh3VLvVuLaRx6n1ACVYgk2Evl3NgiZ0pg="
}
}
[SRP] handleSendQueue: Sending to WebSocket
[SRP] handleSendQueue(): Message sent.
3. WebSocketClientSocketIO_W5500 on NRF52840_FEATHER with W5500 using Ethernet_Generic Library
Start WebSocketClientSocketIO_W5500 on NRF52840_FEATHER with W5x00 using Ethernet_Generic Library
WebSockets_Generic v2.15.0
[WS] Board : NRF52840_FEATHER , setCsPin: 10
[WS] Default SPI pinout:
[WS] MOSI: 25
[WS] MISO: 24
[WS] SCK: 26
[WS] SS: 5
[WS] =========================
WebSockets Client @ IP address: 192.168.2.108
Connecting to WebSockets Server @ IP address: 192.168.2.30, port: 8080
["event_name",{"now":6671}]
[WS] [WS-Client][handleHeader] RX: HTTP/1.1 200 OK
[WS] [WS-Client][handleHeader] RX: Content-Type: text/plain; charset=UTF-8
[WS] [WS-Client][handleHeader] RX: Content-Length: 103
[WS] [WS-Client][handleHeader] RX: Access-Control-Allow-Credentials: true
[WS] [WS-Client][handleHeader] RX: Access-Control-Allow-Origin: file://
[WS] [WS-Client][handleHeader] RX: Set-Cookie: io=ivB-kiMefQhNrlkgAAAd; Path=/; HttpOnly; SameSite=Strict
[WS] [WS-Client][handleHeader] RX: Date: Thu, 08 Oct 2020 00:32:59 GMT
[WS] [WS-Client][handleHeader] RX: Connection: keep-alive
[WS] [WS-Client][handleHeader] RX: Keep-Alive: timeout=5
[WS] [WS-Client][handleHeader] Header read fin.
[WS] [WS-Client][handleHeader] Client settings:
[WS] [WS-Client][handleHeader] - cURL: /socket.io/?EIO=3
[WS] [WS-Client][handleHeader] - cKey: DT1hYS8BbVNsE++xI7B82A==
[WS] [WS-Client][handleHeader] Server header:
[WS] [WS-Client][handleHeader] - cCode: 200
[WS] [WS-Client][handleHeader] - cIsUpgrade: 0
[WS] [WS-Client][handleHeader] - cIsWebsocket: 1
[WS] [WS-Client][handleHeader] - cAccept:
[WS] [WS-Client][handleHeader] - cProtocol: arduino
[WS] [WS-Client][handleHeader] - cExtensions:
[WS] [WS-Client][handleHeader] - cVersion: 0
[WS] [WS-Client][handleHeader] - cSessionId: ivB-kiMefQhNrlkgAAAd
[IOc] Disconnected
[WS] [WS-Client][handleHeader] RX: HTTP/1.1 200 OK
[WS] [WS-Client][handleHeader] RX: Content-Type: text/plain; charset=UTF-8
[WS] [WS-Client][handleHeader] RX: Content-Length: 103
[WS] [WS-Client][handleHeader] RX: Access-Control-Allow-Credentials: true
[WS] [WS-Client][handleHeader] RX: Access-Control-Allow-Origin: file://
[WS] [WS-Client][handleHeader] RX: Set-Cookie: io=Lq1IQW-WBtymSZzzAAAe; Path=/; HttpOnly; SameSite=Strict
[WS] [WS-Client][handleHeader] RX: Date: Thu, 08 Oct 2020 00:32:59 GMT
[WS] [WS-Client][handleHeader] RX: Connection: keep-alive
[WS] [WS-Client][handleHeader] RX: Keep-Alive: timeout=5
[WS] [WS-Client][handleHeader] Header read fin.
[WS] [WS-Client][handleHeader] Client settings:
[WS] [WS-Client][handleHeader] - cURL: /socket.io/?EIO=3
[WS] [WS-Client][handleHeader] - cKey: onWidNpa6PhedJSy60Az5A==
[WS] [WS-Client][handleHeader] Server header:
[WS] [WS-Client][handleHeader] - cCode: 200
[WS] [WS-Client][handleHeader] - cIsUpgrade: 0
[WS] [WS-Client][handleHeader] - cIsWebsocket: 0
[WS] [WS-Client][handleHeader] - cAccept:
[WS] [WS-Client][handleHeader] - cProtocol: arduino
[WS] [WS-Client][handleHeader] - cExtensions:
[WS] [WS-Client][handleHeader] - cVersion: 0
[WS] [WS-Client][handleHeader] - cSessionId: Lq1IQW-WBtymSZzzAAAe
[WS] [WS-Client][handleHeader] RX: HTTP/1.1 101 Switching Protocols
[WS] [WS-Client][handleHeader] RX: Upgrade: websocket
[WS] [WS-Client][handleHeader] RX: Connection: Upgrade
[WS] [WS-Client][handleHeader] RX: Sec-WebSocket-Accept: 92pjBGiagarYGjMy1FsUcKOzrSk=
[WS] [WS-Client][handleHeader] RX: Sec-WebSocket-Protocol: arduino
[WS] [WS-Client][handleHeader] Header read fin.
[WS] [WS-Client][handleHeader] Client settings:
[WS] [WS-Client][handleHeader] - cURL: /socket.io/?EIO=3
[WS] [WS-Client][handleHeader] - cKey: i6rJQeEER2+zCTjRW4OjLg==
[WS] [WS-Client][handleHeader] Server header:
[WS] [WS-Client][handleHeader] - cCode: 101
[WS] [WS-Client][handleHeader] - cIsUpgrade: 1
[WS] [WS-Client][handleHeader] - cIsWebsocket: 1
[WS] [WS-Client][handleHeader] - cAccept: 92pjBGiagarYGjMy1FsUcKOzrSk=
[WS] [WS-Client][handleHeader] - cProtocol: arduino
[WS] [WS-Client][handleHeader] - cExtensions:
[WS] [WS-Client][handleHeader] - cVersion: 0
[WS] [WS-Client][handleHeader] - cSessionId: Lq1IQW-WBtymSZzzAAAe
[IOc] Connected to url: /socket.io/?EIO=3
4. Generic_WebSocketClientSocketIO_EthernetENC on NRF52840_FEATHER with ENC28J60 using EthernetENC Library
Start Generic_WebSocketClientSocketIO_EthernetENC on NRF52840_FEATHER with ENC28J60 using EthernetENC Library
WebSockets_Generic v2.15.0
[WS] Board : NRF52840_FEATHER , setCsPin: 10
[WS] Default SPI pinout:
[WS] MOSI: 25
[WS] MISO: 24
[WS] SCK: 26
[WS] SS: 5
[WS] =========================
WebSockets Client @ IP address: 192.168.2.86
Connecting to WebSockets Server @ IP address: 192.168.2.30, port: 8080
["event_name",{"now":9577}]
[WS] [WS-Client][handleHeader] RX: HTTP/1.1 200 OK
[WS] [WS-Client][handleHeader] RX: Content-Type: text/plain; charset=UTF-8
[WS] [WS-Client][handleHeader] RX: Content-Length: 103
[WS] [WS-Client][handleHeader] RX: Access-Control-Allow-Credentials: true
[WS] [WS-Client][handleHeader] RX: Access-Control-Allow-Origin: file://
[WS] [WS-Client][handleHeader] RX: Set-Cookie: io=W5HMvbfTz5Nbn2SgAAAV; Path=/; HttpOnly; SameSite=Strict
[WS] [WS-Client][handleHeader] RX: Date: Thu, 08 Oct 2020 00:23:11 GMT
[WS] [WS-Client][handleHeader] RX: Connection: keep-alive
[WS] [WS-Client][handleHeader] RX: Keep-Alive: timeout=5
[WS] [WS-Client][handleHeader] Header read fin.
[WS] [WS-Client][handleHeader] Client settings:
[WS] [WS-Client][handleHeader] - cURL: /socket.io/?EIO=3
[WS] [WS-Client][handleHeader] - cKey: tTIoy547t0bFK6IwotJ0Ww==
[WS] [WS-Client][handleHeader] Server header:
[WS] [WS-Client][handleHeader] - cCode: 200
[WS] [WS-Client][handleHeader] - cIsUpgrade: 0
[WS] [WS-Client][handleHeader] - cIsWebsocket: 1
[WS] [WS-Client][handleHeader] - cAccept:
[WS] [WS-Client][handleHeader] - cProtocol: arduino
[WS] [WS-Client][handleHeader] - cExtensions:
[WS] [WS-Client][handleHeader] - cVersion: 0
[WS] [WS-Client][handleHeader] - cSessionId: W5HMvbfTz5Nbn2SgAAAV
[IOc] Disconnected
[WS] [WS-Client][handleHeader] RX: HTTP/1.1 200 OK
[WS] [WS-Client][handleHeader] RX: Content-Type: text/plain; charset=UTF-8
[WS] [WS-Client][handleHeader] RX: Content-Length: 103
[WS] [WS-Client][handleHeader] RX: Access-Control-Allow-Credentials: true
[WS] [WS-Client][handleHeader] RX: Access-Control-Allow-Origin: file://
[WS] [WS-Client][handleHeader] RX: Set-Cookie: io=r1Kx0T7wZNQ9BHk9AAAW; Path=/; HttpOnly; SameSite=Strict
[WS] [WS-Client][handleHeader] RX: Date: Thu, 08 Oct 2020 00:23:11 GMT
[WS] [WS-Client][handleHeader] RX: Connection: keep-alive
[WS] [WS-Client][handleHeader] RX: Keep-Alive: timeout=5
[WS] [WS-Client][handleHeader] Header read fin.
[WS] [WS-Client][handleHeader] Client settings:
[WS] [WS-Client][handleHeader] - cURL: /socket.io/?EIO=3
[WS] [WS-Client][handleHeader] - cKey: BgGmlEiRrKzeEDEHHE48qA==
[WS] [WS-Client][handleHeader] Server header:
[WS] [WS-Client][handleHeader] - cCode: 200
[WS] [WS-Client][handleHeader] - cIsUpgrade: 0
[WS] [WS-Client][handleHeader] - cIsWebsocket: 0
[WS] [WS-Client][handleHeader] - cAccept:
[WS] [WS-Client][handleHeader] - cProtocol: arduino
[WS] [WS-Client][handleHeader] - cExtensions:
[WS] [WS-Client][handleHeader] - cVersion: 0
[WS] [WS-Client][handleHeader] - cSessionId: r1Kx0T7wZNQ9BHk9AAAW
[WS] [WS-Client][handleHeader] RX: HTTP/1.1 101 Switching Protocols
[WS] [WS-Client][handleHeader] RX: Upgrade: websocket
[WS] [WS-Client][handleHeader] RX: Connection: Upgrade
[WS] [WS-Client][handleHeader] RX: Sec-WebSocket-Accept: P76KK/oGpRX1UE1cAtk5jp31+Aw=
[WS] [WS-Client][handleHeader] RX: Sec-WebSocket-Protocol: arduino
[WS] [WS-Client][handleHeader] Header read fin.
[WS] [WS-Client][handleHeader] Client settings:
[WS] [WS-Client][handleHeader] - cURL: /socket.io/?EIO=3
[WS] [WS-Client][handleHeader] - cKey: 1uSPYGC/Asnl0DfyQcW5NQ==
[WS] [WS-Client][handleHeader] Server header:
[WS] [WS-Client][handleHeader] - cCode: 101
[WS] [WS-Client][handleHeader] - cIsUpgrade: 1
[WS] [WS-Client][handleHeader] - cIsWebsocket: 1
[WS] [WS-Client][handleHeader] - cAccept: P76KK/oGpRX1UE1cAtk5jp31+Aw=
[WS] [WS-Client][handleHeader] - cProtocol: arduino
[WS] [WS-Client][handleHeader] - cExtensions:
[WS] [WS-Client][handleHeader] - cVersion: 0
[WS] [WS-Client][handleHeader] - cSessionId: r1Kx0T7wZNQ9BHk9AAAW
[IOc] Connected to url: /socket.io/?EIO=3
5. WIOTerminal_WebSocketClientSSL on SeeedStudio SAMD51 WIO_TERMINAL with Realtek RTL8720DN WiFi using Seeed_Arduino_rpcWiFi Library
Start WIOTerminal_WebSocketClientSSL on WIO_TERMINAL
WebSockets_Generic v2.15.0
WebSockets Client started @ IP address: 192.168.2.150
WebSockets Server : wss://account.duckdns.org
Connected to WebSockets Server @ wss://account.duckdns.org
[WS] [WS-Client] Connect wss...
[WS] [WS-Client] Calling _client.tcp->connect, _host = wss://account.duckdns.org , port = 443
[WS] [WS-Client] Calling _client.tcp->connect, _connectResult = 1
[WS] [WS-Client] connectedCb
[WS] [WS-Client][connectedCb] Connected to Host: wss://account.duckdns.org , Port: 443
[WS] [WS-Client] [sendHeader] Sending header...
[WS] [WS-Client] [sendHeader] Handshake: GET / HTTP/1.1
Host: wss://account.duckdns.org:443
Connection: Upgrade
Upgrade: websocket
Sec-WebSocket-Version: 13
Sec-WebSocket-Key: SfXbpj+U4TexBeIDuBiYog==
Sec-WebSocket-Protocol: arduino
Origin: file://
User-Agent: arduino-WebSocket-Client
6. Generic_WebSocketClientSSL_WiFiNINA on Arduino SAMD21 Nano-33-IoT with WiFiNINA using WiFiNINA_Generic Library
Start Generic_WebSocketClientSSL_WiFiNINA on SAMD_NANO_33_IOT
WebSockets_Generic v2.15.0
Used/default SPI pinout:
MOSI:11
MISO:12
SCK:13
SS:10
Attempting to connect to SSID: HueNet1
SSID: HueNet1
WebSockets Client @ IP Address: 192.168.2.98
signal strength (RSSI):-13 dBm
WebSockets Server : wss://account.duckdns.org
Connected to WebSockets Server @ wss://account.duckdns.org
[WS] [WS-Client] Connect wss...
[WS] [WS-Client] connectedCb
[WS] [WS-Client][connectedCb] Connected to Host: wss://account.duckdns.org , Port: 443
[WS] [WS-Client] [sendHeader] Sending header...
[WS] [WS-Client] [sendHeader] Handshake: GET / HTTP/1.1
Host: wss://account.duckdns.org:443
Connection: Upgrade
Upgrade: websocket
Sec-WebSocket-Version: 13
Sec-WebSocket-Key: XOexobdyHBCcAnl9W4F+9w==
Sec-WebSocket-Protocol: arduino
Origin: file://
User-Agent: arduino-WebSocket-Client
7. WebSocketClientSocketIO_NINA on Arduino SAMD21 Nano-33-IoT with WiFiNINA using WiFiNINA_Generic Library
7.1 Client
Start WebSocketClientSocketIO_NINA on SAMD_NANO_33_IOT
WebSockets_Generic v2.15.0
Used/default SPI pinout:
MOSI:11
MISO:12
SCK:13
SS:10
Attempting to connect to SSID: HueNet1
SSID: HueNet1
WebSockets Client IP Address: 192.168.2.114
signal strength (RSSI):-18 dBm
Connecting to WebSockets Server @ IP address: 192.168.2.30, port: 8080
[WS] WebSockets_Generic v2.15.0
[WS] [wsIOc] found EIO=4 disable EIO ping on client
[WS] [WS-Client] Connect ws...
[WS] [WS-Client][connectedCb] Connected to Host:192.168.2.30, Port:8080
[WS] [WS-Client] [sendHeader] Sending header...
[WS] sendHeader: client->cKey = 7nb1qwQBvz58aozmAyBmag==
[WS] [WS-Client] [sendHeader] Handshake:GET /socket.io/?EIO=4&transport=polling HTTP/1.1
Host: 192.168.2.30:8080
Connection: keep-alive
Origin: file://
User-Agent: arduino-WebSocket-Client
[WS] [WS-Client] [sendHeader] Sending header... Done (us):2669
[WS] [WS-Client][handleHeader] RX:HTTP/1.1 200 OK
[WS] [WS-Client][handleHeader] RX:Content-Type: text/plain; charset=UTF-8
[WS] [WS-Client][handleHeader] RX:Content-Length: 97
[WS] [WS-Client][handleHeader] RX:Date: Mon, 24 May 2021 02:19:53 GMT
[WS] [WS-Client][handleHeader] RX:Connection: keep-alive
[WS] [WS-Client][handleHeader] Header read fin.
[WS] [WS-Client][handleHeader] Client settings:
[WS] [WS-Client][handleHeader] - cURL:/socket.io/?EIO=4
[WS] [WS-Client][handleHeader] - cKey:7nb1qwQBvz58aozmAyBmag==
[WS] [WS-Client][handleHeader] Server header:
[WS] [WS-Client][handleHeader] - cCode:200
[WS] [WS-Client][handleHeader] - cIsUpgrade:0
[WS] [WS-Client][handleHeader] - cIsWebsocket:1
[WS] [WS-Client][handleHeader] - cAccept:
[WS] [WS-Client][handleHeader] - cProtocol:arduino
[WS] [WS-Client][handleHeader] - cExtensions:
[WS] [WS-Client][handleHeader] - cVersion:0
[WS] [WS-Client][handleHeader] - cSessionId:
[WS] [WS-Client][handleHeader] Still missing cSessionId try Socket.IO
[WS] [WS-Client][handleHeader] socket.io json: 0{"sid":"WdrsvWrSeNmPDSlFAAAa","upgrades":["websocket"],"pingInterval":25000,"pingTimeout":20000}
[WS] [WS-Client][handleHeader] - cSessionId: WdrsvWrSeNmPDSlFAAAa
[WS] [WS-Client][handleHeader] Header read fin.
[WS] [WS-Client][handleHeader] Client settings:
[WS] [WS-Client][handleHeader] - cURL:/socket.io/?EIO=4
[WS] [WS-Client][handleHeader] - cKey:7nb1qwQBvz58aozmAyBmag==
[WS] [WS-Client][handleHeader] Server header:
[WS] [WS-Client][handleHeader] - cCode:200
[WS] [WS-Client][handleHeader] - cIsUpgrade:0
[WS] [WS-Client][handleHeader] - cIsWebsocket:1
[WS] [WS-Client][handleHeader] - cAccept:
[WS] [WS-Client][handleHeader] - cProtocol:arduino
[WS] [WS-Client][handleHeader] - cExtensions:
[WS] [WS-Client][handleHeader] - cVersion:0
[WS] [WS-Client][handleHeader] - cSessionId:WdrsvWrSeNmPDSlFAAAa
[WS] [WS-Client][handleHeader] found cSessionId
[WS] [WS-Client] [sendHeader] Sending header...
[WS] sendHeader: client->cKey = 6b1sIaeSY4sl6HQqSLZaKQ==
[WS] [WS-Client] [sendHeader] Handshake:GET /socket.io/?EIO=4&transport=websocket&sid=WdrsvWrSeNmPDSlFAAAa HTTP/1.1
Host: 192.168.2.30:8080
Connection: Upgrade
Upgrade: websocket
Sec-WebSocket-Version: 13
Sec-WebSocket-Key: 6b1sIaeSY4sl6HQqSLZaKQ==
Sec-WebSocket-Protocol: arduino
Origin: file://
User-Agent: arduino-WebSocket-Client
[WS] [WS-Client] [sendHeader] Sending header... Done (us):3458
[WS] [WS-Client][handleHeader] RX:HTTP/1.1 101 Switching Protocols
[WS] [WS-Client][handleHeader] RX:Upgrade: websocket
[WS] [WS-Client][handleHeader] RX:Connection: Upgrade
[WS] [WS-Client][handleHeader] RX:Sec-WebSocket-Accept: KJjOfxcGJBEkOTLzz/+pFRXs0Bc=
[WS] [WS-Client][handleHeader] RX:Sec-WebSocket-Protocol: arduino
[WS] [WS-Client][handleHeader] Header read fin.
[WS] [WS-Client][handleHeader] Client settings:
[WS] [WS-Client][handleHeader] - cURL:/socket.io/?EIO=4
[WS] [WS-Client][handleHeader] - cKey:6b1sIaeSY4sl6HQqSLZaKQ==
[WS] [WS-Client][handleHeader] Server header:
[WS] [WS-Client][handleHeader] - cCode:101
[WS] [WS-Client][handleHeader] - cIsUpgrade:1
[WS] [WS-Client][handleHeader] - cIsWebsocket:1
[WS] [WS-Client][handleHeader] - cAccept:KJjOfxcGJBEkOTLzz/+pFRXs0Bc=
[WS] [WS-Client][handleHeader] - cProtocol:arduino
[WS] [WS-Client][handleHeader] - cExtensions:
[WS] [WS-Client][handleHeader] - cVersion:0
[WS] [WS-Client][handleHeader] - cSessionId:WdrsvWrSeNmPDSlFAAAa
[WS] [WS-Client][handleHeader] Websocket connection init done.
[WS] [wsIOc] Connected to url:/socket.io/?EIO=4
[IOc] Connected to url: /socket.io/?EIO=4
[WS] [wsIOc] get pong
[IOc] Get PONG
[WS] [wsIOc] connected: len = 30
[WS] [wsIOc] data: {"sid":"QPel_hhsFl5pJ9ZpAAAb"}
["event_name",{"now":30001}]
[WS] [wsIOc] get ping send pong:3
[IOc] Get PING
[WS] [WS-Client] Sending HB ping
["event_name",{"now":30001}]
7.2 Server
Using the Socket.IO Server in Nodejs_SocketIO_TestServer
kh@kh-Inspiron-3593:~/Downloads/Nodejs/New_SIO$ nodejs app
Server launched on port 8080
Connected
QPel_hhsFl5pJ9ZpAAAb
JWT token test: { host: '192.168.2.30:8080',
connection: 'keep-alive',
origin: 'file://',
'user-agent': 'arduino-WebSocket-Client' }
Message from Client : { now: 30001 }
8. Generic_WebSocketClientSocketIO_W5500 on NRF52840_FEATHER with W5x00 using Ethernet_Generic Library
8.1 Client
Start Generic_WebSocketClientSocketIO_W5500 on NRF52840_FEATHER with W5x00 using Ethernet_Generic Library
WebSockets_Generic v2.15.0
[WS] Board :NRF52840_FEATHER, setCsPin:10
[WS] Default SPI pinout:
[WS] MOSI:25
[WS] MISO:24
[WS] SCK:26
[WS] SS:5
[WS] =========================
_pinCS = 0
W5100 init, using SS_PIN_DEFAULT = 10, new ss_pin = 10, W5100Class::ss_pin = 10
W5100::init: W5500, SSIZE =8192
WebSockets Client @ IP address: 192.168.2.94
Connecting to WebSockets Server @ IP address: 192.168.2.30, port: 8080
[WS] WebSockets_Generic v2.15.0
[WS] [wsIOc] found EIO=4 disable EIO ping on client
[WS] [WS-Client][connectedCb] Connected to Host:192.168.2.30, Port:8080
[WS] [WS-Client] [sendHeader] Sending header...
[WS] sendHeader: client->cKey = A5uXYZ6TvNkcNshB9bd4mw==
[WS] [WS-Client] [sendHeader] Handshake:GET /socket.io/?EIO=4&transport=polling HTTP/1.1
Host: 192.168.2.30:8080
Connection: keep-alive
Authorization: 1234567890
User-Agent: arduino-WebSocket-Client
[WS] [WS-Client] [sendHeader] Sending header... Done (us):1953
[WS] [WS-Client][handleHeader] RX:HTTP/1.1 200 OK
[WS] [WS-Client][handleHeader] RX:Content-Type: text/plain; charset=UTF-8
[WS] [WS-Client][handleHeader] RX:Content-Length: 97
[WS] [WS-Client][handleHeader] RX:Date: Mon, 24 May 2021 02:44:22 GMT
[WS] [WS-Client][handleHeader] RX:Connection: keep-alive
[WS] [WS-Client][handleHeader] Header read fin.
[WS] [WS-Client][handleHeader] Client settings:
[WS] [WS-Client][handleHeader] - cURL:/socket.io/?EIO=4
[WS] [WS-Client][handleHeader] - cKey:A5uXYZ6TvNkcNshB9bd4mw==
[WS] [WS-Client][handleHeader] Server header:
[WS] [WS-Client][handleHeader] - cCode:200
[WS] [WS-Client][handleHeader] - cIsUpgrade:0
[WS] [WS-Client][handleHeader] - cIsWebsocket:1
[WS] [WS-Client][handleHeader] - cAccept:
[WS] [WS-Client][handleHeader] - cProtocol:arduino
[WS] [WS-Client][handleHeader] - cExtensions:
[WS] [WS-Client][handleHeader] - cVersion:0
[WS] [WS-Client][handleHeader] - cSessionId:
[WS] [WS-Client][handleHeader] Still missing cSessionId try Socket.IO
[WS] [WS-Client][handleHeader] socket.io json: 0{"sid":"NsqUuXlPnVoCSumYAAAc","upgrades":["websocket"],"pingInterval":25000,"pingTimeout":20000}
[WS] [WS-Client][handleHeader] - cSessionId: NsqUuXlPnVoCSumYAAAc
[WS] [WS-Client][handleHeader] Header read fin.
[WS] [WS-Client][handleHeader] Client settings:
[WS] [WS-Client][handleHeader] - cURL:/socket.io/?EIO=4
[WS] [WS-Client][handleHeader] - cKey:A5uXYZ6TvNkcNshB9bd4mw==
[WS] [WS-Client][handleHeader] Server header:
[WS] [WS-Client][handleHeader] - cCode:200
[WS] [WS-Client][handleHeader] - cIsUpgrade:0
[WS] [WS-Client][handleHeader] - cIsWebsocket:1
[WS] [WS-Client][handleHeader] - cAccept:
[WS] [WS-Client][handleHeader] - cProtocol:arduino
[WS] [WS-Client][handleHeader] - cExtensions:
[WS] [WS-Client][handleHeader] - cVersion:0
[WS] [WS-Client][handleHeader] - cSessionId:NsqUuXlPnVoCSumYAAAc
[WS] [WS-Client][handleHeader] found cSessionId
[WS] [WS-Client] [sendHeader] Sending header...
[WS] sendHeader: client->cKey = sQfvRYgeBW4Lg9NMIB977g==
[WS] [WS-Client] [sendHeader] Handshake:GET /socket.io/?EIO=4&transport=websocket&sid=NsqUuXlPnVoCSumYAAAc HTTP/1.1
Host: 192.168.2.30:8080
Connection: Upgrade
Upgrade: websocket
Sec-WebSocket-Version: 13
Sec-WebSocket-Key: sQfvRYgeBW4Lg9NMIB977g==
Sec-WebSocket-Protocol: arduino
Authorization: 1234567890
User-Agent: arduino-WebSocket-Client
[WS] [WS-Client] [sendHeader] Sending header... Done (us):3907
[WS] [WS-Client][handleHeader] RX:HTTP/1.1 101 Switching Protocols
[WS] [WS-Client][handleHeader] RX:Upgrade: websocket
[WS] [WS-Client][handleHeader] RX:Connection: Upgrade
[WS] [WS-Client][handleHeader] RX:Sec-WebSocket-Accept: KSsqUKjgfa1vum+jM9GAEuTogmY=
[WS] [WS-Client][handleHeader] RX:Sec-WebSocket-Protocol: arduino
[WS] [WS-Client][handleHeader] Header read fin.
[WS] [WS-Client][handleHeader] Client settings:
[WS] [WS-Client][handleHeader] - cURL:/socket.io/?EIO=4
[WS] [WS-Client][handleHeader] - cKey:sQfvRYgeBW4Lg9NMIB977g==
[WS] [WS-Client][handleHeader] Server header:
[WS] [WS-Client][handleHeader] - cCode:101
[WS] [WS-Client][handleHeader] - cIsUpgrade:1
[WS] [WS-Client][handleHeader] - cIsWebsocket:1
[WS] [WS-Client][handleHeader] - cAccept:KSsqUKjgfa1vum+jM9GAEuTogmY=
[WS] [WS-Client][handleHeader] - cProtocol:arduino
[WS] [WS-Client][handleHeader] - cExtensions:
[WS] [WS-Client][handleHeader] - cVersion:0
[WS] [WS-Client][handleHeader] - cSessionId:NsqUuXlPnVoCSumYAAAc
[WS] [WS-Client][handleHeader] Websocket connection init done.
[WS] [wsIOc] Connected to url:/socket.io/?EIO=4
[IOc] Connected to url: /socket.io/?EIO=4
[WS] [wsIOc] get pong
[IOc] Get PONG
[WS] [wsIOc] connected: len = 30
[WS] [wsIOc] data: {"sid":"cSx3YyFrDOfxUW8hAAAd"}
Message from Client : { now: 30001 }
8.2 Server
Using the Socket.IO Server in Nodejs_SocketIO_TestServer
kh@kh-Inspiron-3593:~/Downloads/Nodejs/New_SIO$ nodejs app
Server launched on port 8080
Connected
cSx3YyFrDOfxUW8hAAAd
JWT token test: { host: '192.168.2.30:8080',
connection: 'keep-alive',
authorization: '1234567890',
'user-agent': 'arduino-WebSocket-Client' }
Message from Client : { now: 30001 }
9. WebSocketClientSocketIO_W5500 on RASPBERRY_PI_PICO with W5x00 using Ethernet_Generic Library
The following are debug terminal output when running example WebSocketClientSocketIO_W5500 on RASPBERRY_PI_PICO with W5x00 and Ethernet_Generic Library using Earle Philhower's arduino-pico core v1.12.0
9.1 Client
Start WebSocketClientSocketIO_W5500 on RASPBERRY_PI_PICO with W5x00 using Ethernet_Generic Library
WebSockets_Generic v2.15.0
[WS] Board :RASPBERRY_PI_PICO, setCsPin:17
[WS] Default SPI pinout:
[WS] MOSI:19
[WS] MISO:16
[WS] SCK:18
[WS] SS:17
[WS] =========================
WebSockets Client @ IP address: 192.168.2.119
Connecting to WebSockets Server @ IP address: 192.168.2.30, port: 8080
[WS] WebSockets_Generic v2.15.0
[WS] [wsIOc] found EIO=4 disable EIO ping on client
[WS] [WS-Client][connectedCb] Connected to Host:192.168.2.30, Port:8080
[WS] [WS-Client] [sendHeader] Sending header...
[WS] sendHeader: client->cKey = rqJZ543MlA+uTo5YdFR+qA==
[WS] [WS-Client] [sendHeader] Handshake:GET /socket.io/?EIO=4&transport=polling HTTP/1.1
Host: 192.168.2.30:8080
Connection: keep-alive
Authorization: 1234567890
User-Agent: arduino-WebSocket-Client
[WS] [WS-Client] [sendHeader] Sending header... Done (us):2184
[WS] [WS-Client][handleHeader] RX:HTTP/1.1 200 OK
[WS] [WS-Client][handleHeader] RX:Content-Type: text/plain; charset=UTF-8
[WS] [WS-Client][handleHeader] RX:Content-Length: 97
[WS] [WS-Client][handleHeader] RX:Date: Mon, 24 May 2021 04:29:00 GMT
[WS] [WS-Client][handleHeader] RX:Connection: keep-alive
[WS] [WS-Client][handleHeader] Header read fin.
[WS] [WS-Client][handleHeader] Client settings:
[WS] [WS-Client][handleHeader] - cURL:/socket.io/?EIO=4
[WS] [WS-Client][handleHeader] - cKey:rqJZ543MlA+uTo5YdFR+qA==
[WS] [WS-Client][handleHeader] Server header:
[WS] [WS-Client][handleHeader] - cCode:200
[WS] [WS-Client][handleHeader] - cIsUpgrade:0
[WS] [WS-Client][handleHeader] - cIsWebsocket:1
[WS] [WS-Client][handleHeader] - cAccept:
[WS] [WS-Client][handleHeader] - cProtocol:arduino
[WS] [WS-Client][handleHeader] - cExtensions:
[WS] [WS-Client][handleHeader] - cVersion:0
[WS] [WS-Client][handleHeader] - cSessionId:
[WS] [WS-Client][handleHeader] Still missing cSessionId try Socket.IO
[WS] [WS-Client][handleHeader] socket.io json: 0{"sid":"TCiWG1KEq2MHPezpAAAg","upgrades":["websocket"],"pingInterval":25000,"pingTimeout":20000}
[WS] [WS-Client][handleHeader] - cSessionId: TCiWG1KEq2MHPezpAAAg
[WS] [WS-Client][handleHeader] Header read fin.
[WS] [WS-Client][handleHeader] Client settings:
[WS] [WS-Client][handleHeader] - cURL:/socket.io/?EIO=4
[WS] [WS-Client][handleHeader] - cKey:rqJZ543MlA+uTo5YdFR+qA==
[WS] [WS-Client][handleHeader] Server header:
[WS] [WS-Client][handleHeader] - cCode:200
[WS] [WS-Client][handleHeader] - cIsUpgrade:0
[WS] [WS-Client][handleHeader] - cIsWebsocket:1
[WS] [WS-Client][handleHeader] - cAccept:
[WS] [WS-Client][handleHeader] - cProtocol:arduino
[WS] [WS-Client][handleHeader] - cExtensions:
[WS] [WS-Client][handleHeader] - cVersion:0
[WS] [WS-Client][handleHeader] - cSessionId:TCiWG1KEq2MHPezpAAAg
[WS] [WS-Client][handleHeader] found cSessionId
[WS] [WS-Client] [sendHeader] Sending header...
[WS] sendHeader: client->cKey = ADdto91YKZwqbZ0X0v5ceg==
[WS] [WS-Client] [sendHeader] Handshake:GET /socket.io/?EIO=4&transport=websocket&sid=TCiWG1KEq2MHPezpAAAg HTTP/1.1
Host: 192.168.2.30:8080
Connection: Upgrade
Upgrade: websocket
Sec-WebSocket-Version: 13
Sec-WebSocket-Key: ADdto91YKZwqbZ0X0v5ceg==
Sec-WebSocket-Protocol: arduino
Authorization: 1234567890
User-Agent: arduino-WebSocket-Client
[WS] [WS-Client] [sendHeader] Sending header... Done (us):2851
[WS] [WS-Client][handleHeader] RX:HTTP/1.1 101 Switching Protocols
[WS] [WS-Client][handleHeader] RX:Upgrade: websocket
[WS] [WS-Client][handleHeader] RX:Connection: Upgrade
[WS] [WS-Client][handleHeader] RX:Sec-WebSocket-Accept: gKekYE3itucoN6vDWPglIu3GU1U=
[WS] [WS-Client][handleHeader] RX:Sec-WebSocket-Protocol: arduino
[WS] [WS-Client][handleHeader] Header read fin.
[WS] [WS-Client][handleHeader] Client settings:
[WS] [WS-Client][handleHeader] - cURL:/socket.io/?EIO=4
[WS] [WS-Client][handleHeader] - cKey:ADdto91YKZwqbZ0X0v5ceg==
[WS] [WS-Client][handleHeader] Server header:
[WS] [WS-Client][handleHeader] - cCode:101
[WS] [WS-Client][handleHeader] - cIsUpgrade:1
[WS] [WS-Client][handleHeader] - cIsWebsocket:1
[WS] [WS-Client][handleHeader] - cAccept:gKekYE3itucoN6vDWPglIu3GU1U=
[WS] [WS-Client][handleHeader] - cProtocol:arduino
[WS] [WS-Client][handleHeader] - cExtensions:
[WS] [WS-Client][handleHeader] - cVersion:0
[WS] [WS-Client][handleHeader] - cSessionId:TCiWG1KEq2MHPezpAAAg
[WS] [WS-Client][handleHeader] Websocket connection init done.
[WS] [wsIOc] Connected to url:/socket.io/?EIO=4
[IOc] Connected to url: /socket.io/?EIO=4
[WS] [wsIOc] get pong
[IOc] Get PONG
[WS] [wsIOc] connected: len = 30
[WS] [wsIOc] data: {"sid":"kcgaqp1ovWXOgjCnAAAh"}
["event_name",{"now":30001}]
[WS] [wsIOc] get ping send pong:3
[IOc] Get PING
[WS] [WS-Client] Sending HB ping
["event_name",{"now":60002}]
[WS] [wsIOc] get ping send pong:3
[WS] [wsIOc] get ping send pong:3
["event_name",{"now":90003}]
[WS] [wsIOc] get ping send pong:3
[IOc] Get PING
[WS] [WS-Client] Sending HB ping
["event_name",{"now":120004}]
[WS] [wsIOc] get ping send pong:3
["event_name",{"now":150005}]
[WS] [wsIOc] get ping send pong:3
9.2 Server
Using the Socket.IO Server in Nodejs_SocketIO_TestServer
kh@kh-Inspiron-3593:~/Downloads/Nodejs/New_SIO$ nodejs app
Server launched on port 8080
Connected
kcgaqp1ovWXOgjCnAAAh
JWT token test: { host: '192.168.2.30:8080',
connection: 'keep-alive',
authorization: '1234567890',
'user-agent': 'arduino-WebSocket-Client' }
Message from Client : { now: 30001 }
Message from Client : { now: 60002 }
Message from Client : { now: 90003 }
Message from Client : { now: 120004 }
Message from Client : { now: 150005 }
10. WebSocketClientSocketIO_W5500 on MBED RASPBERRY_PI_PICO with W5x00 using Ethernet_Generic Library
The following are debug terminal output when running example WebSocketClientSocketIO_W5500 on RASPBERRY_PI_PICO with W5x00 and Ethernet_Generic Library using Arduino-mbed RP2040 core
10.1 Client
Start WebSocketClientSocketIO_W5500 on RaspberryPi Pico with W5x00 using Ethernet_Generic Library
WebSockets_Generic v2.15.0
[WS] Board :RaspberryPi Pico, setCsPin:17
[WS] Default SPI pinout:
[WS] MOSI:19
[WS] MISO:16
[WS] SCK:18
[WS] SS:17
[WS] =========================
WebSockets Client @ IP address: 192.168.2.98
Connecting to WebSockets Server @ IP address: 192.168.2.30, port: 8080
[WS] WebSockets_Generic v2.15.0
[WS] [wsIOc] found EIO=4 disable EIO ping on client
[WS] [WS-Client][connectedCb] Connected to Host:192.168.2.30, Port:8080
[WS] [WS-Client] [sendHeader] Sending header...
[WS] sendHeader: client->cKey = fDyOMZVB7gvbnhOZclfWcA==
[WS] [WS-Client] [sendHeader] Handshake:GET /socket.io/?EIO=4&transport=polling HTTP/1.1
Host: 192.168.2.30:8080
Connection: keep-alive
Authorization: 1234567890
User-Agent: arduino-WebSocket-Client
[WS] [WS-Client] [sendHeader] Sending header... Done (us):3217
[WS] [WS-Client][handleHeader] RX:HTTP/1.1 200 OK
[WS] [WS-Client][handleHeader] RX:Content-Type: text/plain; charset=UTF-8
[WS] [WS-Client][handleHeader] RX:Content-Length: 97
[WS] [WS-Client][handleHeader] RX:Date: Mon, 24 May 2021 04:37:41 GMT
[WS] [WS-Client][handleHeader] RX:Connection: keep-alive
[WS] [WS-Client][handleHeader] Header read fin.
[WS] [WS-Client][handleHeader] Client settings:
[WS] [WS-Client][handleHeader] - cURL:/socket.io/?EIO=4
[WS] [WS-Client][handleHeader] - cKey:fDyOMZVB7gvbnhOZclfWcA==
[WS] [WS-Client][handleHeader] Server header:
[WS] [WS-Client][handleHeader] - cCode:200
[WS] [WS-Client][handleHeader] - cIsUpgrade:0
[WS] [WS-Client][handleHeader] - cIsWebsocket:1
[WS] [WS-Client][handleHeader] - cAccept:
[WS] [WS-Client][handleHeader] - cProtocol:arduino
[WS] [WS-Client][handleHeader] - cExtensions:
[WS] [WS-Client][handleHeader] - cVersion:0
[WS] [WS-Client][handleHeader] - cSessionId:
[WS] [WS-Client][handleHeader] Still missing cSessionId try Socket.IO
[WS] [WS-Client][handleHeader] socket.io json: 0{"sid":"7zb9ikut5ezr2H6kAAAi","upgrades":["websocket"],"pingInterval":25000,"pingTimeout":20000}
[WS] [WS-Client][handleHeader] - cSessionId: 7zb9ikut5ezr2H6kAAAi
[WS] [WS-Client][handleHeader] Header read fin.
[WS] [WS-Client][handleHeader] Client settings:
[WS] [WS-Client][handleHeader] - cURL:/socket.io/?EIO=4
[WS] [WS-Client][handleHeader] - cKey:fDyOMZVB7gvbnhOZclfWcA==
[WS] [WS-Client][handleHeader] Server header:
[WS] [WS-Client][handleHeader] - cCode:200
[WS] [WS-Client][handleHeader] - cIsUpgrade:0
[WS] [WS-Client][handleHeader] - cIsWebsocket:1
[WS] [WS-Client][handleHeader] - cAccept:
[WS] [WS-Client][handleHeader] - cProtocol:arduino
[WS] [WS-Client][handleHeader] - cExtensions:
[WS] [WS-Client][handleHeader] - cVersion:0
[WS] [WS-Client][handleHeader] - cSessionId:7zb9ikut5ezr2H6kAAAi
[WS] [WS-Client][handleHeader] found cSessionId
[WS] [WS-Client] [sendHeader] Sending header...
[WS] sendHeader: client->cKey = m1MElaS+NSouCUhWjSLPug==
[WS] [WS-Client] [sendHeader] Handshake:GET /socket.io/?EIO=4&transport=websocket&sid=7zb9ikut5ezr2H6kAAAi HTTP/1.1
Host: 192.168.2.30:8080
Connection: Upgrade
Upgrade: websocket
Sec-WebSocket-Version: 13
Sec-WebSocket-Key: m1MElaS+NSouCUhWjSLPug==
Sec-WebSocket-Protocol: arduino
Authorization: 1234567890
User-Agent: arduino-WebSocket-Client
[WS] [WS-Client] [sendHeader] Sending header... Done (us):4878
[WS] [WS-Client][handleHeader] RX:HTTP/1.1 101 Switching Protocols
[WS] [WS-Client][handleHeader] RX:Upgrade: websocket
[WS] [WS-Client][handleHeader] RX:Connection: Upgrade
[WS] [WS-Client][handleHeader] RX:Sec-WebSocket-Accept: r/1zdz7Sk+4eMliZJTebh6cH7uw=
[WS] [WS-Client][handleHeader] RX:Sec-WebSocket-Protocol: arduino
[WS] [WS-Client][handleHeader] Header read fin.
[WS] [WS-Client][handleHeader] Client settings:
[WS] [WS-Client][handleHeader] - cURL:/socket.io/?EIO=4
[WS] [WS-Client][handleHeader] - cKey:m1MElaS+NSouCUhWjSLPug==
[WS] [WS-Client][handleHeader] Server header:
[WS] [WS-Client][handleHeader] - cCode:101
[WS] [WS-Client][handleHeader] - cIsUpgrade:1
[WS] [WS-Client][handleHeader] - cIsWebsocket:1
[WS] [WS-Client][handleHeader] - cAccept:r/1zdz7Sk+4eMliZJTebh6cH7uw=
[WS] [WS-Client][handleHeader] - cProtocol:arduino
[WS] [WS-Client][handleHeader] - cExtensions:
[WS] [WS-Client][handleHeader] - cVersion:0
[WS] [WS-Client][handleHeader] - cSessionId:7zb9ikut5ezr2H6kAAAi
[WS] [WS-Client][handleHeader] Websocket connection init done.
[WS] [wsIOc] Connected to url:/socket.io/?EIO=4
[IOc] Connected to url: /socket.io/?EIO=4
[WS] [wsIOc] get pong
[IOc] Get PONG
[WS] [wsIOc] connected: len = 30
[WS] [wsIOc] data: {"sid":"7SXGNMJxjtzOWXClAAAj"}
["event_name",{"now":30001}]
[WS] [wsIOc] get ping send pong:3
[IOc] Get PING
[WS] [WS-Client] Sending HB ping
["event_name",{"now":60002}]
[WS] [wsIOc] get ping send pong:3
["event_name",{"now":90003}]
[WS] [wsIOc] get ping send pong:3
[WS] [wsIOc] get ping send pong:3
[IOc] Get PING
[WS] [WS-Client] Sending HB ping
["event_name",{"now":120004}]
10.2 Server
Using the Socket.IO Server in Nodejs_SocketIO_TestServer
kh@kh-Inspiron-3593:~/Downloads/Nodejs/New_SIO$ nodejs app
Server launched on port 8080
Connected
7SXGNMJxjtzOWXClAAAj
JWT token test: { host: '192.168.2.30:8080',
connection: 'keep-alive',
authorization: '1234567890',
'user-agent': 'arduino-WebSocket-Client' }
Message from Client : { now: 30001 }
Message from Client : { now: 60002 }
Message from Client : { now: 90003 }
Message from Client : { now: 120005 }
11. WT32_ETH01_WebSocketClientSocketIO on WT32_ETH01
The following are debug terminal output when running example WT32_ETH01_WebSocketClientSocketIO on WT32_ETH01
11.1 Client
Starting WT32_ETH01_WebSocketClient on ESP32_DEV with ETH_PHY_LAN8720
WebServer_WT32_ETH01 v1.4.1
WebSockets_Generic v2.15.0
ETH MAC: A8:03:2A:A1:61:73, IPv4: 192.168.2.232, FULL_DUPLEX, 100Mbps
WebSockets Client started @ IP address: 192.168.2.232
Connecting to WebSockets Server @ IP address: 192.168.2.30, port: 8080
[WS] [WS-Client] Connect ws...
[IOc] Disconnected
[WS] [WS-Client] Connect ws...
[WS] [WS-Client][connectedCb] Connected to Host:192.168.2.30, Port:8080
[WS] [wsIOc] Connected to url:/socket.io/?EIO=4
[IOc] Connected to url: /socket.io/?EIO=4
[WS] [wsIOc] get pong
[IOc] Get PONG
[WS] [wsIOc] connected: len = 30
[WS] [wsIOc] data: {"sid":"cxEI-kMvZ1uKiyQ-AAAB"}
["event_name",{"now":30001}]
[WS] [wsIOc] get event: len = 53
[WS] [wsIOc] get data: ["Send Message io.emit Broadcasted : ",{"now":30001}]
[IOc] Get event: ["Send Message io.emit Broadcasted : ",{"now":30001}]
[WS] [wsIOc] get event: len = 33
[WS] [wsIOc] get data: ["Send Message : ",{"now":30001}]
[IOc] Get event: ["Send Message : ",{"now":30001}]
[WS] [wsIOc] get ping send pong:3
[IOc] Get PING
[WS] [WS-Client] Sending HB ping
["event_name",{"now":60002}]
[WS] [wsIOc] get event: len = 53
[WS] [wsIOc] get data: ["Send Message io.emit Broadcasted : ",{"now":60002}]
[IOc] Get event: ["Send Message io.emit Broadcasted : ",{"now":60002}]
[WS] [wsIOc] get event: len = 33
[WS] [wsIOc] get data: ["Send Message : ",{"now":60002}]
[IOc] Get event: ["Send Message : ",{"now":60002}]
[WS] [wsIOc] get ping send pong:3
["event_name",{"now":90003}]
[WS] [wsIOc] get event: len = 53
[WS] [wsIOc] get data: ["Send Message io.emit Broadcasted : ",{"now":90003}]
[IOc] Get event: ["Send Message io.emit Broadcasted : ",{"now":90003}]
[WS] [wsIOc] get event: len = 33
[WS] [wsIOc] get data: ["Send Message : ",{"now":90003}]
[IOc] Get event: ["Send Message : ",{"now":90003}]
[WS] [wsIOc] get ping send pong:3
[IOc] Get PING
[WS] [WS-Client] Sending HB ping
["event_name",{"now":120004}]
[WS] [wsIOc] get event: len = 54
[WS] [wsIOc] get data: ["Send Message io.emit Broadcasted : ",{"now":120004}]
[IOc] Get event: ["Send Message io.emit Broadcasted : ",{"now":120004}]
[WS] [wsIOc] get event: len = 34
[WS] [wsIOc] get data: ["Send Message : ",{"now":120004}]
[IOc] Get event: ["Send Message : ",{"now":120004}]
[WS] [wsIOc] get ping send pong:3
11.2 Server
Using the Socket.IO Server in Nodejs_SocketIO_TestServer
kh@kh-Inspiron-3593:~/Downloads/Nodejs/New_SIO$ nodejs app
Server launched on port 8080
Connected
cxEI-kMvZ1uKiyQ-AAAB
JWT token test: { host: '192.168.2.30:8080',
connection: 'keep-alive',
authorization: '1234567890',
'user-agent': 'arduino-WebSocket-Client' }
Message from Client : { now: 30001 }
Message from Client : { now: 60002 }
Message from Client : { now: 90003 }
Message from Client : { now: 120004 }
12. Teensy_WebSocketClientSocketIO_QNEthernet on TEENSY 4.1 using QNEthernet
The following are debug terminal output when running example Teensy_WebSocketClientSocketIO_QNEthernet on TEENSY 4.1 using QNEthernet
library
12.1 Client
Starting Teensy_WebSocketClient_QNEthernet on TEENSY 4.1 using QNEthernet
WebSockets_Generic v2.15.0
=========== USE_QN_ETHERNET ===========
Initialize Ethernet using static IP => Connected! IP address:192.168.2.222
Connecting to WebSockets Server @ IP address: 192.168.2.30, port: 8080
[IOc] Connected to url: /socket.io/?EIO=4
["event_name",{"now":30001}]
[IOc] Get event: ["Send Message io.emit Broadcasted : ",{"now":30001}]
[IOc] Get event: ["Send Message : ",{"now":30001}]
["event_name",{"now":60002}]
[IOc] Get event: ["Send Message io.emit Broadcasted : ",{"now":60002}]
[IOc] Get event: ["Send Message : ",{"now":60002}]
["event_name",{"now":90003}]
[IOc] Get event: ["Send Message io.emit Broadcasted : ",{"now":90003}]
[IOc] Get event: ["Send Message : ",{"now":90003}]
12.2 Server
Using the Socket.IO Server in Nodejs_SocketIO_TestServer
kh@kh-Inspiron-3593:~/Downloads/Nodejs/New_SIO$ ./SIO_server.sh
Server launched on port 8080
Connected
bK733pVgbd3DCsy5AAAB
JWT token test: { host: '192.168.2.30:8080',
connection: 'keep-alive',
authorization: '1234567890',
'user-agent': 'arduino-WebSocket-Client' }
Message from Client : { now: 30001 }
Message from Client : { now: 60002 }
Message from Client : { now: 90003 }
13. Portenta_H7_WebSocketClientSocketIO on PORTENTA_H7_M7 with Ethernet
The following are debug terminal output when running example Portenta_H7_WebSocketClientSocketIO on PORTENTA_H7_M7 with Ethernet using Portenta_Ethernet Library
13.1 Client
Start Portenta_H7_WebSocketClientSocketIO on PORTENTA_H7_M7 with Ethernet using Portenta_Ethernet Library
WebSockets_Generic v2.15.0
WebSockets Client @ IP address: 192.168.2.132
Connecting to WebSockets Server @ IP address: 192.168.2.30, port: 8080
[WS] [WS-Client][connectedCb] Connected to Host:192.168.2.30, Port:8080
[WS] [wsIOc] Connected to url:/socket.io/?EIO=4
[IOc] Connected to url: /socket.io/?EIO=4
[WS] [wsIOc] get pong
[IOc] Get PONG
[WS] [wsIOc] connected: len = 30
[WS] [wsIOc] data: {"sid":"RqchvIdY1DWbvxTpAAAB"}
["event_name",{"now":30001}]
[WS] [wsIOc] get event: len = 53
[WS] [wsIOc] get data: ["Send Message io.emit Broadcasted : ",{"now":30001}]
[IOc] Get event: ["Send Message io.emit Broadcasted : ",{"now":30001}]
[WS] [wsIOc] get event: len = 33
[WS] [wsIOc] get data: ["Send Message : ",{"now":30001}]
[IOc] Get event: ["Send Message : ",{"now":30001}]
[WS] [wsIOc] get ping send pong:3
[IOc] Get PING
[WS] [WS-Client] Sending HB ping
["event_name",{"now":60006}]
[WS] [wsIOc] get event: len = 53
[WS] [wsIOc] get data: ["Send Message io.emit Broadcasted : ",{"now":60006}]
[IOc] Get event: ["Send Message io.emit Broadcasted : ",{"now":60006}]
[WS] [wsIOc] get event: len = 33
[WS] [wsIOc] get data: ["Send Message : ",{"now":60006}]
[IOc] Get event: ["Send Message : ",{"now":60006}]
[WS] [wsIOc] get ping send pong:3
13.2 Server
Using the Socket.IO Server in Nodejs_SocketIO_TestServer
kh@kh-Inspiron-3593:~/Downloads/Nodejs/New_SIO$ ./SIO_server.sh
Server launched on port 8080
Connected
RqchvIdY1DWbvxTpAAAB
JWT token test: { host: '192.168.2.30:8080',
connection: 'keep-alive',
authorization: '1234567890',
'user-agent': 'arduino-WebSocket-Client' }
Message from Client : { now: 30001 }
Message from Client : { now: 60006 }
14. WebSocketClientSocketIO_WiFi on Portenta_H7 using WiFi
The following are debug terminal output when running example WebSocketClientSocketIO_WiFi on Portenta_H7 using Murata
WiFi
14.1 Client
Start WebSocketClientSocketIO_WiFi on PORTENTA_H7_M7
WebSockets_Generic v2.15.0
Connecting to SSID: HueNet1
SSID: HueNet1
WebSockets Client IP Address: 192.168.2.130
signal strength (RSSI):-27 dBm
Connecting to WebSockets Server @ IP address: 192.168.2.30, port: 8080
[IOc] Connected to url: /socket.io/?EIO=4
["event_name",{"now":30001}]
[IOc] Get event: ["Send Message io.emit Broadcasted : ",{"now":30001}]
[IOc] Get event: ["Send Message : ",{"now":30001}]
["event_name",{"now":60002}]
[IOc] Get event: ["Send Message io.emit Broadcasted : ",{"now":60002}]
[IOc] Get event: ["Send Message : ",{"now":60002}]
["event_name",{"now":90003}]
[IOc] Get event: ["Send Message io.emit Broadcasted : ",{"now":90003}]
[IOc] Get event: ["Send Message : ",{"now":90003}]
["event_name",{"now":121501}]
[IOc] Get event: ["Send Message io.emit Broadcasted : ",{"now":121501}]
[IOc] Get event: ["Send Message : ",{"now":121501}]
["event_name",{"now":151503}]
[IOc] Get event: ["Send Message io.emit Broadcasted : ",{"now":151503}]
[IOc] Get event: ["Send Message : ",{"now":151503}]
14.2 Server
Using the Socket.IO Server in Nodejs_SocketIO_TestServer
kh@kh-Inspiron-3593:~/Downloads/Nodejs/New_SIO$ ./SIO_server.sh
Server launched on port 8080
Connected
nr4syN7HdG1PlCYrAAAF
JWT token test: { host: '192.168.2.30:8080',
connection: 'keep-alive',
authorization: '1234567890',
'user-agent': 'arduino-WebSocket-Client' }
Message from Client : { now: 30001 }
Message from Client : { now: 60002 }
Message from Client : { now: 90003 }
Message from Client : { now: 121501 }
Message from Client : { now: 151503 }
Message from Client : { now: 181506 }
15. Portenta_H7_WebSocketClient_Sticky_SocketIO on PORTENTA_H7_M7 using Ethernet
The following are debug terminal output when running example Portenta_H7_WebSocketClient_Sticky_SocketIO on Portenta_H7 using Vision-shield Ethernet.
Start Portenta_H7_WebSocketClient_Sticky_SocketIO on PORTENTA_H7_M7 with Ethernet using Portenta_Ethernet Library
WebSockets_Generic v2.15.0
WebSockets Client @ IP address: 192.168.2.133
Connecting to WebSockets Server @ IP address: 192.168.2.30, port: 8080
[WS] WebSockets_Generic v2.15.0
[WS] [wsIOc] found EIO=4 disable EIO ping on client
[WS] [WS-Client][connectedCb] Connected to Host:192.168.2.30, Port:8080
[WS] [WS-Client] [sendHeader] Sending header...
[WS] sendHeader: client->cKey = Kp/b0RFGMw/WSNGn35/s3A==
[WS] [WS-Client] [sendHeader] Handshake:GET /socket.io/?EIO=4&transport=websocket HTTP/1.1
Host: 192.168.2.30:8080
Connection: keep-alive
Authorization: 1234567890
User-Agent: arduino-WebSocket-Client
[WS] [WS-Client] [sendHeader] Sending header... Done (us):712
[WS] [WS-Client][handleHeader] RX:HTTP/1.1 200 OK
[WS] [WS-Client][handleHeader] RX:Date: Sun, 12 Dec 2021 05:58:29 GMT
[WS] [WS-Client][handleHeader] RX:Connection: keep-alive
[WS] [WS-Client][handleHeader] RX:Keep-Alive: timeout=5
[WS] [WS-Client][handleHeader] RX:Transfer-Encoding: chunked
[WS] [WS-Client][handleHeader] Header read fin.
[WS] [WS-Client][handleHeader] Client settings:
[WS] [WS-Client][handleHeader] - cURL:/socket.io/?EIO=4
[WS] [WS-Client][handleHeader] - cKey:Kp/b0RFGMw/WSNGn35/s3A==
[WS] [WS-Client][handleHeader] Server header:
[WS] [WS-Client][handleHeader] - cCode:200
[WS] [WS-Client][handleHeader] - cIsUpgrade:0
[WS] [WS-Client][handleHeader] - cIsWebsocket:1
[WS] [WS-Client][handleHeader] - cAccept:
[WS] [WS-Client][handleHeader] - cProtocol:arduino
[WS] [WS-Client][handleHeader] - cExtensions:
[WS] [WS-Client][handleHeader] - cVersion:0
[WS] [WS-Client][handleHeader] - cSessionId:
[WS] [WS-Client][handleHeader] Still missing cSessionId try Socket.IO
[WS] [WS-Client][handleHeader] socket.io json: c
hello world
0
[WS] [WS-Client][handleHeader] RX:c
hello world
0
[WS] [WS-Client][handleHeader] Header error:c
hello world
0
[WS] [WS-Client][handleClientData] Header response timeout.. Disconnecting!
[IOc] Disconnected
[WS] [wsIOc] Disconnected!
[WS] [WS-Client][connectedCb] Connected to Host:192.168.2.30, Port:8080
[WS] [WS-Client] [sendHeader] Sending header...
[WS] sendHeader: client->cKey = dm6SsOCMRZwhNjKmQeo2lw==
[WS] [WS-Client] [sendHeader] Handshake:GET /socket.io/?EIO=4&transport=websocket HTTP/1.1
Host: 192.168.2.30:8080
Connection: keep-alive
Authorization: 1234567890
User-Agent: arduino-WebSocket-Client
16. ESP32_WebSocketClientSocketIO on ESP32S3_DEV
The following are debug terminal output when running example ESP32_WebSocketClientSocketIO on ESP32S3_DEV
Start ESP32_WebSocketClientSocketIO on ESP32S3_DEV
WebSockets_Generic v2.15.0
Connecting to HueNet1
WebSockets Client started @ IP address: 192.168.2.83
Connecting to WebSockets Server @ IP address: 192.168.2.30, port: 8080
[WS] [WS-Client] beginSocketIO with IPAddress
[WS] [WS-Client] beginSocketIO with const char
[WS] WebSockets_Generic v2.12.0
[WS] [wsIOc] found EIO=4 disable EIO ping on client
[WS] [WS-Client] Connect ws...
[WS] [WS-Client] Calling _client.tcp->connect, _host =192.168.2.30, port =8080
[WS] [WS-Client] Calling _client.tcp->connect, _connectResult =1
[WS] [WS-Client] connectedCb
[WS] [WS-Client][connectedCb] Connected to Host:192.168.2.30, Port:8080
[WS] [WS-Client] [sendHeader] Sending header...
[WS] sendHeader: client->cKey = 8FGfIMaycpbZsGx1WcjYPg==
[WS] [WS-Client] [sendHeader] Handshake:GET /socket.io/?EIO=4&transport=polling HTTP/1.1
Host: 192.168.2.30:8080
Connection: keep-alive
Authorization: 1234567890
User-Agent: arduino-WebSocket-Client
[WS] [write] n:166, t:10047
[WS] [write] Write, Length :166, Left :0
[WS] [WS-Client] [sendHeader] Sending header... Done (us):32263
[WS] [WS-Client][handleHeader] RX:HTTP/1.1 200 OK
[WS] [WS-Client][handleHeader] RX:Content-Type: text/plain; charset=UTF-8
[WS] [WS-Client][handleHeader] RX:Content-Length: 97
[WS] [WS-Client][handleHeader] RX:Date: Mon, 14 Feb 2022 23:52:21 GMT
[WS] [WS-Client][handleHeader] RX:Connection: keep-alive
[WS] [WS-Client][handleHeader] RX:Keep-Alive: timeout=5
[WS] [WS-Client][handleHeader] Header read fin.
[WS] [WS-Client][handleHeader] Client settings:
[WS] [WS-Client][handleHeader] - cURL:/socket.io/?EIO=4
[WS] [WS-Client][handleHeader] - cKey:8FGfIMaycpbZsGx1WcjYPg==
[WS] [WS-Client][handleHeader] Server header:
[WS] [WS-Client][handleHeader] - cCode:200
[WS] [WS-Client][handleHeader] - cIsUpgrade:0
[WS] [WS-Client][handleHeader] - cIsWebsocket:1
[WS] [WS-Client][handleHeader] - cAccept:
[WS] [WS-Client][handleHeader] - cProtocol:arduino
[WS] [WS-Client][handleHeader] - cExtensions:
[WS] [WS-Client][handleHeader] - cVersion:0
[WS] [WS-Client][handleHeader] - cSessionId:
[WS] [WS-Client][handleHeader] Still missing cSessionId try Socket.IO
[WS] [WS-Client][handleHeader] socket.io json: 0{"sid":"p6g2ESTze400qtXcAAAE","upgrades":["websocket"],"pingInterval":25000,"pingTimeout":20000}
[WS] [WS-Client][handleHeader] - cSessionId: p6g2ESTze400qtXcAAAE
[WS] [WS-Client][handleHeader] Header read fin.
[WS] [WS-Client][handleHeader] Client settings:
[WS] [WS-Client][handleHeader] - cURL:/socket.io/?EIO=4
[WS] [WS-Client][handleHeader] - cKey:8FGfIMaycpbZsGx1WcjYPg==
[WS] [WS-Client][handleHeader] Server header:
[WS] [WS-Client][handleHeader] - cCode:200
[WS] [WS-Client][handleHeader] - cIsUpgrade:0
[WS] [WS-Client][handleHeader] - cIsWebsocket:1
[WS] [WS-Client][handleHeader] - cAccept:
[WS] [WS-Client][handleHeader] - cProtocol:arduino
[WS] [WS-Client][handleHeader] - cExtensions:
[WS] [WS-Client][handleHeader] - cVersion:0
[WS] [WS-Client][handleHeader] - cSessionId:p6g2ESTze400qtXcAAAE
[WS] [WS-Client][handleHeader] found cSessionId
[WS] [WS-Client] [sendHeader] Sending header...
[WS] sendHeader: client->cKey = 2btvEqbCEn69Vmh40QfIaA==
[WS] [WS-Client] [sendHeader] Handshake:GET /socket.io/?EIO=4&transport=websocket&sid=p6g2ESTze400qtXcAAAE HTTP/1.1
Host: 192.168.2.30:8080
Connection: Upgrade
Upgrade: websocket
Sec-WebSocket-Version: 13
Sec-WebSocket-Key: 2btvEqbCEn69Vmh40QfIaA==
Sec-WebSocket-Protocol: arduino
Authorization: 1234567890
User-Agent: arduino-WebSocket-Client
[WS] [write] n:315, t:10268
[WS] [write] Write, Length :315, Left :0
[WS] [WS-Client] [sendHeader] Sending header... Done (us):42597
[WS] [WS-Client][handleHeader] RX:HTTP/1.1 101 Switching Protocols
[WS] [WS-Client][handleHeader] RX:Upgrade: websocket
[WS] [WS-Client][handleHeader] RX:Connection: Upgrade
[WS] [WS-Client][handleHeader] RX:Sec-WebSocket-Accept: MokU7OGA/lZbCC0KeEZT6+rp5l0=
[WS] [WS-Client][handleHeader] RX:Sec-WebSocket-Protocol: arduino
[WS] [WS-Client][handleHeader] Header read fin.
[WS] [WS-Client][handleHeader] Client settings:
[WS] [WS-Client][handleHeader] - cURL:/socket.io/?EIO=4
[WS] [WS-Client][handleHeader] - cKey:2btvEqbCEn69Vmh40QfIaA==
[WS] [WS-Client][handleHeader] Server header:
[WS] [WS-Client][handleHeader] - cCode:101
[WS] [WS-Client][handleHeader] - cIsUpgrade:1
[WS] [WS-Client][handleHeader] - cIsWebsocket:1
[WS] [WS-Client][handleHeader] - cAccept:MokU7OGA/lZbCC0KeEZT6+rp5l0=
[WS] [WS-Client][handleHeader] - cProtocol:arduino
[WS] [WS-Client][handleHeader] - cExtensions:
[WS] [WS-Client][handleHeader] - cVersion:0
[WS] [WS-Client][handleHeader] - cSessionId:p6g2ESTze400qtXcAAAE
[WS] [WS-Client][handleHeader] Websocket connection init done.
[WS] [headerDone] Header Handling Done. Client:0
[WS] [wsIOc] Connected to url:/socket.io/?EIO=4
[WS] [sendFrame] ------- send message frame -------
[WS] [sendFrame] Client:0
[WS] fin:1
[WS] opCode:1
[WS] mask:1
[WS] length:6
[WS] headerToPayload:0
[WS] [sendFrame] Client: 0, text:2probe
[WS] [sendFrame] pack to one TCP package... Client:0
[WS] [write] n:12, t:10411
[WS] [write] Write, Length :12, Left :0
[WS] [sendFrame] ------- send message frame -------
[WS] [sendFrame] Client:0
[WS] fin:1
[WS] opCode:1
[WS] mask:1
[WS] length:1
[WS] headerToPayload:1
[WS] [sendFrame] Client: 0, text:5
[WS] [write] n:7, t:10433
[WS] [write] Write, Length :7, Left :0
[IOc] Connected to url: /socket.io/?EIO=4
[WS] [write] n:6, t:10435
[WS] [write] Write, Length :6, Left :0
[WS] [write] n:2, t:10446
[WS] [write] Write, Length :2, Left :0
[WS] [write] n:1, t:10447
[WS] [write] Write, Length :1, Left :0
[WS] [handleWebsocketWaitFor] Client: 0, size:2
[WS] cWsRXsize:0
[WS] [readCb] n:2, t:10459
[WS] [readCb] Receive Length =2, left =0
[WS] [handleWebsocketWaitFor][readCb] Client: 0, size:2
[WS] ok:1
[WS] [handleWebsocket] ------- read massage frame ------- Client:0
[WS] [handleWebsocket] Client: 0, fin:1
[WS] rsv1:0
[WS] rsv2:0
[WS] rsv3:0
[WS] opCode:1
[WS] [handleWebsocket] Client: 0, mask:0
[WS] payloadLen:6
[WS] [readCb] n:6, t:10491
[WS] [readCb] Receive Length =6, left =0
[WS] [handleWebsocketPayloadCb] Client: 0, text:3probe
[WS] [wsIOc] get pong
[IOc] Get PONG
[WS] [handleWebsocketWaitFor] Client: 0, size:2
[WS] cWsRXsize:0
[WS] [readCb] n:2, t:10512
[WS] [readCb] Receive Length =2, left =0
[WS] [handleWebsocketWaitFor][readCb] Client: 0, size:2
[WS] ok:1
[WS] [handleWebsocket] ------- read massage frame ------- Client:0
[WS] [handleWebsocket] Client: 0, fin:1
[WS] rsv1:0
[WS] rsv2:0
[WS] rsv3:0
[WS] opCode:1
[WS] [handleWebsocket] Client: 0, mask:0
[WS] payloadLen:32
[WS] [readCb] n:32, t:10544
[WS] [readCb] Receive Length =32, left =0
[WS] [handleWebsocketPayloadCb] Client: 0, text:40{"sid":"356v34mdH9BycjJpAAAF"}
[WS] [wsIOc] connected: len = 30
[WS] [wsIOc] data: {"sid":"356v34mdH9BycjJpAAAF"}
17. ESP8266_AsyncWSClient on ESP8266_NODEMCU_ESP12E
The following are debug terminal output when running example ESP8266_AsyncWSClient on ESP8266_NODEMCU_ESP12E
Start ESP8266_AsyncWSClient on ESP8266_NODEMCU_ESP12E
WebSockets_Generic v2.15.0
WebSockets Client started @ IP address: 192.168.2.145
Connecting to WebSockets Server @ 192.168.2.30
Connected to WebSockets Server @ IP address: 192.168.2.30
["From Async ESP8266_NODEMCU_ESP12E",{"now":2070}]
[WS] [WS-Client][connectedCb] Connected to Host:192.168.2.30, Port:8080
[WSc] Connected to url: /
[WSc] get text: Connected
[WSc] get ping
["From Async ESP8266_NODEMCU_ESP12E",{"now":32075}]
[WSc] get text: ["From Async Async ESP8266_NODEMCU_ESP12E",{"now":32075}]
[WSc] get ping
["From Async Async ESP8266_NODEMCU_ESP12E",{"now":62077}]
[WSc] get text: ["From Async ESP8266_NODEMCU_ESP12E",{"now":62077}]
[WSc] get ping
["From Async ESP8266_NODEMCU_ESP12E",{"now":92079}]
[WSc] get text: ["From Async ESP8266_NODEMCU_ESP12E",{"now":92079}]
[WSc] get ping
["From Async ESP8266_NODEMCU_ESP12E",{"now":122081}]
[WSc] get text: ["From Async ESP8266_NODEMCU_ESP12E",{"now":122081}]
[WSc] get ping
["From Async ESP8266_NODEMCU_ESP12E",{"now":152083}]
[WSc] get text: ["From Async ESP8266_NODEMCU_ESP12E",{"now":152083}]
[WSc] get ping
["From Async ESP8266_NODEMCU_ESP12E",{"now":182085}]
[WSc] get text: ["From Async ESP8266_NODEMCU_ESP12E",{"now":182085}]
[WSc] get ping
["From Async ESP8266_NODEMCU_ESP12E",{"now":212087}]
[WSc] get text: ["From Async ESP8266_NODEMCU_ESP12E",{"now":212087}]
[WSc] get ping
["From Async ESP8266_NODEMCU_ESP12E",{"now":242089}]
[WSc] get text: ["From Async ESP8266_NODEMCU_ESP12E",{"now":242089}]
Debug
Debug is enabled by default on Serial. To disable, add at the beginning of sketch
/* Comment this out to disable prints and save space */
#define DEBUG_WEBSOCKETS_PORT Serial
#define _WEBSOCKETS_LOGLEVEL_ 4
Troubleshooting
If you get compilation errors, more often than not, you may need to install a newer version of the board's core, dependent libraries or this library version.
Sometimes, the library will only work if you update the core to the newer or older version because some function compatibility.
Issues
Submit issues to: WebSockets_Generic issues
TO DO
- Bug Searching and Killing
- Support more types of boards using WiFi/Ethernet shields (Teensy, etc.)
- Support more non-compatible Ethernet Libraries such as Ethernet_Shield_W5200, EtherCard, EtherSia
- Support ASYNC mode for boards using communication libraries supporting Async (STM32, Portenta, Teensy 4.1, ESP32, etc.)
DONE
- Add support to Arduino SAMD21 (ZERO, MKR, NANO_33_IOT, etc.)
- Add support to Adafruit SAMD21 (Itsy-Bitsy M0, Metro M0, Feather M0 Express, etc.).
- Add support to Adafruit SAMD51 (Itsy-Bitsy M4, Metro M4, Grand Central M4, Feather M4 Express, etc.).
- Add support to Adafruit nRF52 ( Feather nRF52832, nRF52840 Express, BlueFruit Sense, Itsy-Bitsy nRF52840 Express, Metro nRF52840 Express, NINA_B302_ublox, NINA_B112_ublox, etc.
- 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.)
- Add support to STM32F/L/H/G/WB/MP1 (Nucleo-144, Nucleo-64, Nucleo-32, Discovery, STM32Fx, STM32H7, STM32Lx, STM32Gx, STM32WB, STM32MP1, etc.) having 64K+ Flash program memory.
- Add support to Ethernet W5x00, using either
Ethernet
,Ethernet2
,Ethernet3
orEthernetLarge
library - Add support to WiFiNINA using WiFiNINA or WiFiNINA_Generic library.
- Add support to ENC28J60 using
UIPEthernet
- Add support to ENC28J60 using
EthernetENC
- Add support to Teensy using W5x00, ENC28J60, WiFiNINA
- Add support to Teensy 4.1 built-in Ethernet using
NativeEthernet
library - Add support to STM32F/L/H/G/WB/MP1 using built-in LAN8742A and
STM32Ethernet
- Add support to SeeedStudio WIO Terminal with Realtek RTL8720DN WiFi using
Seeed_Arduino_rpcWiFi
andSeeed_Arduino_rpcUnified
libraries - Add support to SAMD_MKR1000 and SAMD_MKRWIFI1010 using WiFi101
- Fix breaking problem with SocketIO.
- Default to EIOv4
- Add support to RP2040-based boards, such as RASPBERRY_PI_PICO, ADAFRUIT_FEATHER_RP2040 and GENERIC_RP2040, using Earle Philhower's arduino-pico core v1.3.1+.
- Add support to RP2040-based boards, such as RASPBERRY_PI_PICO, ADAFRUIT_FEATHER_RP2040 and GENERIC_RP2040, using Arduino-mbed RP2040 core.
- Add support to WT32_ETH01 boards using ESP32-based boards and LAN8720 Ethernet
- Add support to Teensy 4.1 built-in Ethernet using
QNEthernet
library - Add support to Portenta_H7, using either
Murata WiFi
orVision-shield Ethernet
- Auto detect ESP32 core to use for WT32_ETH01
- Fix bug in WT32_ETH01 examples to reduce connection time
- Add option to use transport=websocket with sticky-session SIO server
- Add SSL support to ESP32-based WT32_ETH01 boards
- Add support to ESP32_S3, ESP32_C3
- Add
sIOtype_PING
andsIOtype_PING
SocketIO events. - Don't use
deprecated sha.h
for ESP32 core v1.0.6+. - Optimize code by passing by
reference
instead ofvalue
- Fix ASYNC bug for ESP8266 when using NETWORK_ESP8266_ASYNC
- Use new Ethernet_Generic library as default for W5x00.
Contributions and Thanks
- Based on and modified from Markus Sattler's arduinoWebSockets library
- Thanks to Anson He for the PR Fix compile error for Wio Terminal to fix SeeedStudio SEEED_WIO_TERMINAL compile errors and leading to new version v2.3.3.
- Thanks to Jose A.Molina for the enhancement request WiFi101 and Arduino MKR1000. #10, and help testing, leading to new version v2.5.0, and v2.6.0
- Thanks to Ideen Kaffee Korner for
- the enhancement request Run websocket only mode for Socket.IO #16, leading to new version v2.11.1
- the issue Ethernet with SSL #17, leading to new version v2.12.0 to support SSL for WT32_ETH01 using LAN8720 Ethernet
- the issue Ping events propagated to main code socketIO events #18, leading to new version v2.13.0 to add
sIOtype_PING
andsIOtype_PING
SocketIO events
![]() ⭐️⭐️ Markus Sattler |
![]() Anson He |
![]() Jose A. Molina |
![]() ⭐️ Ideen Kaffee Korner |
Contributing
If you want to contribute to this project:
- Report bugs and errors
- Ask for enhancements
- Create issues and pull requests
- Tell other people about this library
License and credits
-
Most of the credits go to original author Markus Sattler.
-
The library is licensed under GPLv3
-
libb64 written by Chris Venter. It is distributed under Public Domain see LICENSE.