How To Install Using Arduino Library Manager
Why do we need this WebSockets_Generic
Many Web services require WebSockets library, which is so far written only for ESP8266/ESP32 boards. The ESP boards so far rely on the Markus Sattler's WebSockets Library to connect to Alexa via Sinric or SinricPro skills.
This Markus Sattler's WebSockets 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, STM32, Teensy, SAM DUE, etc. and enable those boards to use WebSockets services, including voice-control Alexa along with Blynk. Those supported boards can also run WebSockets Server. The WebSockets can be used with ESP’s WiFi, WiFiNINA, WiFi101, W5x00, LAN8720 and ENC28J60 Ethernet
Major Release v2.8.0
1. Add support to WT32_ETH01 (ESP32 + LAN8720) boards
2. Add examples with new features
Supported features of RFC6455
- text frame
- binary frame
- connection close
- ping
- pong
- continuation frame
1. Example code ESP32_WebSocketClientSSL
2. This is the terminal output when running WT32_ETH01_WebSocketClientSocketIO example on WT32_ETH01:
Code: Select all
Starting WT32_ETH01_WebSocketClientSocketIO on ESP32_DEV with ETH_PHY_LAN8720
WebServer_WT32_ETH01 v1.1.0
WebSockets_Generic v2.8.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
[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