How to use Websocket in ESP8266
Here I am going to give example of ESP8266 websocket
1. What is websockets?
WebSocket is a computer communications protocol, providing full-duplex communication channels over a single TCP connection. ... The WebSocket protocol enables interaction between a web client (such as a browser) and a web server with lower overheads, facilitating real-time data transfer from and to the server.
1. What is websockets?
WebSocket is a computer communications protocol, providing full-duplex communication channels over a single TCP connection. ... The WebSocket protocol enables interaction between a web client (such as a browser) and a web server with lower overheads, facilitating real-time data transfer from and to the server.
- Full duplex communication
- Lower latency interaction,
- Enhances the efficiency of Client and Server Communication,
- User-friendly API,
- Opens complete Duplex Link over the Web.
Bill of Materials
- Nodemcu v1.0 (ESP8266),
- DS32331 board with EEPROM 24C32,
- Jumper wires to connect the boards.
Connection details:
Connect 3v3 and Gnd to power up the DS3231 board and SDA & SCL connect to D1 & D2 pin as shown in figure above. now plug in to usb connection and upload the program. To download a program click here.
Check here for one more example with code.
Check here for one more example with code.
Features of this program:
- Send date time to web page from DS3231 RTC board,
- 24C32 EEPROM used to store the switch status and read back when we needed,
- Using JSON format for communication between web page and ESP8266,
- CSS and JS file loaded to CSS & JS folder by ESP8266,
- EEPROM will recall the switch status after restart/startup.
Screen short of the web page see below:
See the below Video:
No comments