一个可以热更通讯事件/数据模型/定时器的node服务端架构,采用websocket通信
A node server allows hot update logics/ data model / timer in runtime, using websocket protocol
- 运行时热更消息事件
- 运行时热更数据模型
- websocket通信
- 日志
- Hot update message event logics in runtime
- Hot update data model in runtime
- Websocket protocol
- Logs
- MongoDB组件
- 定时器
- 完善小Demo
- MongoDB component
- Timer component
- A complete tiny demo
-
Clone本项目
-
进入项目目录
cd Server npm install node app.js
-
在
Controller
目录下新建文件,参考gameController
和loginController
的写法即可 -
在
Model
目录下新建文件,参考player
的写法即可 -
用socket.io客户端连接
ws://{ip}:{port}/socket.io/?EIO=3&transport=websocket
,默认在8001端口
-
Clone the repo
-
Enter the repo directory
cd Server npm install node app.js
-
Create new files under
Controller
directory, referencegameController
andloginController
while writing new controllers -
Create new files under
Model
directory, referenceplayer
while writing new controllers -
Use socket.io client connect
ws://{ip}:{port}/socket.io/?EIO=3&transport=websocket
, default on port 8001
- socketio@2.4.1
- log4js@6.3.0
- chokidar@3.5.2
- decache@4.6.1