English 中文(简体)
Cant 第二次在同一页执行Socket.on(连接,功能(){})
原标题:Cant execute Socket.on( connect ,function(){}) for the second time in same page

我试图用简单的标识和标志来制作一个简单的图象。 伐木正在进入房间,而伐木正用袖珍材料离开房间。 休假(房间);

问题在于,如果在同一个网页上一只记录不复读,则该代码在袖珍.on(连接......)内不执行。 请帮助我解决这一问题。

最佳回答

和Jakub一样,当客户与服务器连接,而不是坐在一间房间时,联系活动会火。 房间是连接顶上的外名空间。 如果你希望每当有人加入时执行守则,最简单的办法是,在<代码>后适用该守则。

一种比喻的骗局,尽管也许更包罗万象的解决办法是,要把某种手套放在一起来。 如果你能够做到<条码>,请上(加入,fn),但可以开枪。 如果做不到工作,你就应当能够通过背靠背书,例如这样做可以做到:

socket.manager.store.subscribe( join , function (id, room) {
    //do whatever
}); 
问题回答

暂无回答




相关问题
How to make Sequelize use singular table names

I have an model called User but Sequelize looks for the table USERS whenever I am trying to save in the DB. Does anyone know how to set Sequelize to use singular table names? Thanks.

What is Node.js? [closed]

I don t fully get what Node.js is all about. Maybe it s because I am mainly a web based business application developer. What is it and what is the use of it? My understanding so far is that: The ...

Clientside going serverside with node.js

I`ve been looking for a serverside language for some time, and python got my attention somewhat. But as I already know and love javascript, I now want learn to code on the server with js and node.js. ...

Can I use jQuery with Node.js?

Is it possible to use jQuery selectors/DOM manipulation on the server-side using Node.js?

How do I escape a string for a shell command in node?

In nodejs, the only way to execute external commands is via sys.exec(cmd). I d like to call an external command and give it data via stdin. In nodejs there does yet not appear to be a way to open a ...

热门标签