https://github.com/magnusthor/thorio.tcpclient
TCPClient for thor.io - used to connect to a server ThorIO.TCPServer (Engine)
https://github.com/magnusthor/thorio.tcpclient
Last synced: about 2 months ago
JSON representation
TCPClient for thor.io - used to connect to a server ThorIO.TCPServer (Engine)
- Host: GitHub
- URL: https://github.com/magnusthor/thorio.tcpclient
- Owner: MagnusThor
- License: mit
- Created: 2016-03-23T13:08:01.000Z (over 10 years ago)
- Default Branch: master
- Last Pushed: 2016-04-19T11:38:51.000Z (over 10 years ago)
- Last Synced: 2025-02-21T15:55:12.124Z (over 1 year ago)
- Language: JavaScript
- Homepage: https://github.com/MagnusThor/thorio/wiki
- Size: 4.88 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# thorio.tcpclient
##About
TCPClient for thor.io - used to connect to a server ThorIO.TCPServer (Engine endpoint).
The ThorIO.TCPClient is a complement to the ThorIO.Client (WebSocket) that enables you to connect to a thor.io using a raw `socket` . See the wiki pages of thor.io for futher information - https://github.com/MagnusThor/thorio/wiki
##Example
This example shows how to use the ThorIO.TCPClient
var thorIO = require("tthorio-tcpclient");
// ctor host, port and Controller (channel)
var client = new thorIO.TcpClient("localhost", "4502", "foo");
client.onopen = function(ci) {
console.log("connected to endpoint and 'foo' controller/channel", ci);
// add a listener for "say"
client.setProperty("age", 11);
client.on("say", function(data) {
console.log("say", data);
});
setInterval(function() {
client.invoke("sayTo", {
message: "foo",
created: new Date()
});
}, 4000);
};
client.onclose = function() {
console.log("connection to enpoint closed...");
};
client.connect(); // open the connection