|
|
před 2 roky | |
|---|---|---|
| .. | ||
| web | před 2 roky | |
| Makefile | před 2 roky | |
| README.md | před 2 roky | |
| appweb.conf | před 2 roky | |
| chat.c | před 2 roky | |
| esp.json | před 2 roky | |
| load.es | před 2 roky | |
| start.me | před 2 roky | |
This sample shows how to create a chat server using WebSockets and ESP. This application echos incoming packets back to all clients. The application source is in chat.c. This is a simple ESP controler with one action that is run in response to the URI:
/ws/test/chat
The HTML page web/index.html is served to the client browser to issue a web socket request.
The server is configured to keep the web socket open for 10 minutes of inactivity and then close the connection.
make
make run
The server listens on port 8080. Browse to:
http://localhost:8080/
This opens a web socket and sends any messages entered into the text field to all clients.