Arduino as WebServer + WebSocket server

Hi all,

I would like to use a websocket server + a web server in the same sketch.
I don't know how to mix the both.
How to do ??

Because I would like to update a web page in realtime but not with ajax.
Just need to update my web page when new datas incoming into the board (mega2560) from a couple of sensors.

My web page is a html + javascript code, and would like to host this page on a sdCard.
When I do a request to the server, the webpage should be delivered,
and in a second time, websocket protocol should be used between the browser and server

I do not want to use a third server, or nodejs, or others..

Someone could give me an example for that kind of project pse ?

All examples, I can find, use ajax or the html +JS page hosted on the computer.


Here is a good example that uses both.