use socket.io Developing Gobang game

Time:2021-2-22

preface

The company needs to use in the project of developing wechat applet socket.io So write a simple project to practice and get familiar with it socket.io . socket.io It is mainly used for real-time communication between browser and server. Websocket in HTML5 is encapsulated. I don’t want to talk about the details. If you are interested, you can goOfficial websiteTake a look.

Technology stack

node.js + socket.io + js + canvas

Source address

https://github.com/XNAL/socketio-gobang

Project operation

git clone https://github.com/XNAL/socketio-gobang
cd socketio-gobang
npm install

node socketServer

Use browser to open / public index.html File is enough

explain

  1. This project is just a simple realization of the function of the war, the page effect of the project is also relatively water (also can see…), the focus of this project is not the effect of the page.
  2. Need to run at least two pages at the same time to start the game, interested can do their own man-machine combat function.

Project screenshot

use socket.io Developing Gobang game

Recommended Today

Redis design and implementation 4: Dictionary Dict

In redis, the dictionary is the infrastructure. Redis database data, expiration time and hash type all take the dictionary as the underlying structure. Structure of dictionary Hashtable The implementation code of hash table is as follows:dict.h/dictht The dictionary of redis is implemented in the form of hash table. typedef struct dictht { //Hash table array, […]