简体   繁体   English

套接字io多个游戏室

[英]Socket io Multiple Game Rooms

I'm working on a multiplayer chess website with different rooms and connecting two players, all through Socket IO and Node JS something similar to http://www.retichess.com/play/NjUwMS41ODM1SERrSEVt/30/0 . 我正在一个具有不同房间的多人国际象棋网站上工作,并通过Socket IO和Node JS连接两个玩家,类似于http://www.retichess.com/play/NjUwMS41ODM1SERrSEVt/30/0 As for now it looks like this http://www.group7port2.azurewebsites.net 到目前为止,看起来像这样http://www.group7port2.azurewebsites.net

The problem i'm having is not understanding how to establish the connection between both players as they do on RetiChess and their URL Generation. 我遇到的问题是不了解如何在RetiChess和URL Generation上建立两个玩家之间的连接。

Where should I start looking at? 我应该从哪里开始看? Thanks! 谢谢!

If you read through Socket.IO documentation, you'll learn more about the Room concept. 如果阅读Socket.IO文档,您将了解有关Room概念的更多信息。 There is never such a thing as direct player connection. 从来没有直接的玩家联系这样的事情。 There is always the server in between. 两者之间总是有服务器。

Sharing an URL allows a player to join another player's room and that's it! 共享URL允许一个玩家加入另一个玩家的房间,仅此而已!

Your job is to be able to send data from one player to the other, while they are in the same socket.IO room! 您的工作是要能够将一个播放器中的数据发送到另一个播放器,而它们却位于同一插槽中。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM