V
V
virtualhero2017-09-21 11:35:22
JavaScript
virtualhero, 2017-09-21 11:35:22

How to connect 2 users on the site?

How can you implement a connection of 2 people on the site, for example, in the game sea battle, so that 2 people can play with each other?
I decided to try to establish a connection for this purpose with long requests, but I can’t catch up on how to connect two users.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
V
Vladimir Skibin, 2017-09-21
@virtualhero

Your server should store the state of each of the players and process all the logic, and give the clients only a render of this state and receive commands to change it.

K
kulaeff, 2017-09-21
@kulaeff

Look towards socket.io.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question