New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details
Socket
Book a DemoSign in
Socket

dogsvr

Package Overview
Dependencies
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

dogsvr

Nodejs package for developing game server

latest
Source
npmnpm
Version
0.2.0
Version published
Maintainers
1
Created
Source

dogsvr

dogsvr is a game server package based on nodejs, and makes writing game server easier for rapid development of small teams.

features

  • Adapt to multiple connection methods
  • User-defined protocol serialization
  • Hot update server logic

usage

  • installing dogsvr
npm install dogsvr
npm install dogsvr-cl-tsrpc
  • creating 2 files at least, one is main thread file, the other is worker thread file

  • writing main thread file

import * as dogsvr from 'dogsvr/main_thread';
import { TsrpcCL } from 'dogsvr-cl-tsrpc';

const connLayer: TsrpcCL = new TsrpcCL(3000); // connection layer using tsrpc
const mainThreadInfo: dogsvr.MainThreadInfo =
{
    workerThreadRunFile: "./test_svr_logic.js", // worker thread file name
    workerThreadNum: 2,
    connLayer: connLayer,
}
dogsvr.startServer(mainThreadInfo);
  • writing worker thread file
import * as dogsvr from 'dogsvr/worker_thread';

// register command handler
dogsvr.regCmdHandler(10001, async (reqMsg: dogsvr.Msg, innerReq: dogsvr.MsgBodyType) => {
    const req = JSON.parse(innerReq as string);

    const res = {res: "I am dog"};
    dogsvr.respondCmd(reqMsg, JSON.stringify(res));
})
  • run server by pm2
pm2 start test_svr.js  #test_svr.js is main thread file
pm2 trigger test_svr hotUpdate  #hot update when any logic file has been changed

Please see dogsvr-example-proj for more.

architecture

TODO

FAQs

Package last updated on 19 Feb 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts