mage-module-shard
Module to help you create distributed MAGE modules.
Installation
npm install --save mage-module-shard
Usage
Please take note the following requirments:
- Methods on objects will not be set on the remote node; you should stick to sending only data objects
lib/modules/sharded/index.ts
This module works as follow:
- Call
this.createShard(string)
to receive a proxy instance; all API calls made on this proxy will always be forwarded to the same server - Keep this proxy around: Normally, you will pass this to your game client(s)
- Reuse the proxy data in future calls: Game clients will send you back this data, and you will use it to route other related calls to the same MAGE node
Todo
- broadcast: send a call to all nodes in the cluster and receive an array of responses
- set attributes over shard/broadcasts
- limit: only let a limited number of nodes run this module
License
MIT