最佳答案
所以,我最近一直在努力理解 Socket.io,但我并不是一个超级伟大的程序员,而且几乎我在网上找到的每一个例子(相信我,我已经找了很久很久) ,都有额外的东西让事情变得复杂。很多示例都会做一些让我感到困惑的事情,或者连接到一些奇怪的数据库,或者使用咖啡脚本或者大量的 JS 库把东西弄得乱七八糟。
I'd love to see a basic, functioning example where the server just sends a message to the client every 10 seconds, saying what time it is, and the client writes that data to the page or throws up an alert, something very simple. Then I can figure things out from there, add stuff I need like db connections, etc. And yes I have checked the examples on the socket.io site and they don't work for me, and I don't understand what they do.