mmo-server
Simple NodeJS Massive-Multiplayers-Online game server.
This is an HTTP server, more suited for HTML5 games.
By default, it will serve static pages from a specified location (option www
).
But you can register URLs to be Javascript services.
Here is an example of how to use this module to create your own server:
var Server = ; var server = ; server; serverstart // Path of static files. root: "./www" // Port to listen on. If not defined (or defined to zero), the first free port // will be automatically selected. port: 8000 // Function called as soon as the server starts successfully. // `args` is an object with the following attributes: // * `address`: hostname or IP address. // * `port`: port on which the server is listening. { console; } // Function called if the server failed to start. // `err` is the error message. { console; } ;
If you want to test this mini server, just create a mini project like this:
mkdir my-project
cd my-project
npm install --save mmo-server
Then, create the file test.js
in your new folder my-project
and fill it with the code of our example. Come back in the folder and type:
node test.js
Your server is up and running!
You can test it with this command:
firefox "http://localhost:8000/ADD?[3,7]"
Client
Here is an example of a browser client using the summation service described in the previous example:
window; // You can use this function as is to send queries to a specific service.// The return is a Promise. { return { ; } ;}