Comparing version 0.1.2 to 0.1.3
@@ -273,7 +273,7 @@ var net = require('net') | ||
// Call again when ready instead of erroring?.. maybe? yes? no? | ||
/*this.on('connect', function() { | ||
this.methodCall.apply(this, arguments); | ||
});*/ | ||
var args = arguments; | ||
this.once('connect', function() { | ||
this.query.apply(this, args); | ||
}); | ||
callback(new Error('Not connected!')); | ||
return false; | ||
@@ -280,0 +280,0 @@ } |
var Client = require('./client'); | ||
var xmlrpc = exports | ||
/** | ||
* Creates an XML-RPC client. | ||
* Creates an GbxRemote client. | ||
* | ||
@@ -14,4 +12,4 @@ * @param {Number} port | ||
*/ | ||
xmlrpc.createClient = function(port, host, callback) { | ||
exports.createClient = function(port, host, callback) { | ||
return new Client(port, host, callback); | ||
} |
{ "name" : "gbxremote" | ||
, "description" : "A pure JavaScript GBXRemote client." | ||
, "keywords" : [ "xml-rpc", "xmlrpc", "xml", "rpc", "gbxremote", "maniaplanet", "trackmania", "shootmania", "questmania", "nadeo" ] | ||
, "version" : "0.1.2" | ||
, "version" : "0.1.3" | ||
, "preferGlobal" : false | ||
@@ -6,0 +6,0 @@ , "homepage" : "https://github.com/MiniGod/node-gbxremote" |
@@ -100,3 +100,3 @@ Node-GbxRemote | ||
#### Event: connect | ||
#### Event: connect() | ||
@@ -121,6 +121,6 @@ Emitted when connection to the server is successfull. | ||
#### Event: error | ||
#### Event: error(err) | ||
Emitted when: | ||
* Socket errors *(host not listening on that port, loose connection, ect.)* | ||
* Socket errors *(host is not listening on that port, loose connection, etc.)* | ||
* Handshake fails *(host* ***is*** *listening on that port, but its not a ManiaPlanet (GbxRemote 2) server)* | ||
@@ -136,10 +136,10 @@ | ||
#### Event: callback | ||
#### Event: callback(method, params) | ||
After sending `EnableCallbacks(true)` to the server, it will send you callbacks when stuff happend on the server. | ||
Eg: | ||
* ManiaPlanet.ServerStart | ||
* ManiaPlanet.ServerStop | ||
* ManiaPlanet.PlayerConnect | ||
* ManiaPlanet.PlayerChat | ||
* `ManiaPlanet.ServerStart` | ||
* `ManiaPlanet.ServerStop` | ||
* `ManiaPlanet.PlayerConnect` | ||
* `ManiaPlanet.PlayerChat` | ||
@@ -163,4 +163,6 @@ [See the full list of callbacks](http://server.xaseco.org/callbacks2.php) | ||
Callbacks will also emit seperate events for each method. It's hard to explain. Learn from example: | ||
#### Event: \<method\>(params) | ||
Callbacks will also emit separate events for each method. It's hard to explain. Learn from example: | ||
```javascript | ||
@@ -188,2 +190,24 @@ var client = gbxremote.createClient(5000); | ||
#### Event: close(had_error) | ||
Emitted once the socket is fully closed. | ||
The argument had_error is a boolean which says if the socket was closed due to a transmission error. | ||
```javascript | ||
var client = gbxremote.createClient(5000); | ||
client.on('connect', function() { | ||
// Connected... | ||
// Do stuff? | ||
// Disconnect | ||
client.terminate(); | ||
}); | ||
client.on('close', function(had_error) { | ||
console.log('Connection to the server has been closed'); | ||
}); | ||
``` | ||
Testing | ||
@@ -190,0 +214,0 @@ --- |
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
62004
17
824
236
2