Network - rogerscg/era-engine GitHub Wiki

The ERA Network library is a wrapper around making and handling HTTP and WebSockets requests to your servers. In conjunction with the NetworkRegistry, communicating with your game or visual's server is very straightforward.

Creating a new Network instance

To create a new network instance for, say, your stats server, use:

const server = NetworkRegistry.registerNewServer('stats');

At any point in your game, you can get your network instance:

const server = NetworkRegistry.get('stats');

Making Requests

Once you have your network instance, you can make requests and await their response:

const playerStats = await server.createGetRequest('/player/1');
await server.createPostRequest('/record', statsObj);

WebSockets/Socket.io

  • Note: WebSockets support is not fully ready for public use. If you'd like you can try.