Example of arrow movement c socket.io

Please give an example of the movement of the arrows with socket.io.

If arrow movement means that you need to remotely move shapes on another machine in real time, then I’d recommend you avoid websockets.

Websockets are based on TCP which a slow protocol that prioritizes good and orderly delivery of the packets. Not suitable for real-time gaming.

You need to follow this tutorial; It uses Colyseus and shows step-by-step how to cover all the basic aspects of real-time multiplayer:

  • input management (answers your original question)
  • state synchronization
  • authoritative server
  • linear interpolation & client-side prediction

NB. If your goal is to develop your game without a multiplayer library like Colyseus, then you should consider Peer.js as it’s WebRTC based. That’s a fast protocol.