pomelo-node-tcp-client
v0.1.5
Published
pomelo node tcp client
Downloads
4
Readme
pomelo-node-tcp-client
Node.js client library for Pomelo framework
Install:
npm install pomelo-node-tcp-client
Usage: var Pomelo = require("pomelo-node-tcp-client")
pomelo.init("127.0.0.1", 3010,{}, function() { console.log('success'); pomelo.request("connector.entryHandler.entry", {}, onEntry); });
function onEntry(object){ console.log("got it: " + object); }
Notify: pomelo.notify("gameManager.gameHandler.startGame", {});
Events: pomelo.on("gameManager.gameHandler.gameEvent", handleGameEvents);
function handleGameEvents(event){ console.log("handle: " + util.inspect(event)); switch(event.gameEvent.type){ case "myEvent_01": console.log("let's do something with it"); break; case "gameStart": console.log("game has started"); break; ... } }