Do i create a array storing all the client sockets, a socket is
created when the users logs in.
如果您使用socket.io模块来管理客户端和服务器之间的连接,那么您不必担心结构或存储的客户端,因为它将在后台为您管理.如果客户端浏览器不支持WebSockets等高级传输,它还提供各种后备(包括长轮询).
Another thing how can i update the webpage or the view if something
has updated in the database do i poll the server every second?
不要每秒轮询服务器,因为长轮询和WebSocket等传输被引入到AVOID中.由于您将使用socket.io(使用长轮询或WebSockets等技术和技术)在客户端和服务器之间建立持久连接,因此您可以轻松创建事件系统,以更新或通知某些客户当时的更改.什么时候发生.
I am using MySQL has database, should i used Redis instead?
Redis是非常好的Key / Value存储库,用于实时,经常更新的数据,不需要复杂的查询.如果您需要对数据进行高级查询支持,请尝试查看MongoDB.