obniz to be used
Callback function is called when there is a change in TCP connection status.
// Javascript Example
var tcp = obniz.getFreeTcp();
tcp.onconnection = data => {
console.log(data);
};
tcp.connectWait(80,"obniz.io");
You can get the error message that occurred when connecting.
// Javascript Example
var tcp = obniz.getFreeTcp();
tcp.connectWait(80,"obniz.io");
tcp.onerror = state => {
console.log(state);
};
Callback function is called when TCP is received.
// Javascript Example
var tcp = obniz.getFreeTcp();
tcp.connectWait(80,"obniz.io");
tcp.onreceive = data => {
console.log(data);
};
Rsponse waiting timeout in milliseconds
Starts a connection on the port and domain for which TCP is specified.
// Javascript Example
var tcp = obniz.getFreeTcp();
tcp.connectWait(80,"obniz.io");
Calls each of the listeners registered for a given event.
Terminates the TCP session.
// Javascript Example
var tcp = obniz.getFreeTcp();
tcp.end();
Return an array listing the events for which the emitter has registered listeners.
Return the number of listeners listening to a given event.
Return the listeners registered for a given event.
Add a listener for a given event.
Add a one-time listener for a given event.
Wait for TCP reception.
// Javascript Example
var tcp = obniz.getFreeTcp();
tcp.connectWait(80,"obniz.io");
let data = await tcp.readWait();
console.log(data);
Remove all listeners, or those of the specified event.
Remove the listeners of a given event.
The argument data is sent by TCP.
If you pass a string or Array type argument, the data will be sent.
// Javascript Example
var tcp = obniz.getFreeTcp();
tcp.connectWait(80,"obniz.io");
// Array
tcp.write([0,1,2,3,4]);
// Text
tcp.write('hello');
Generated using TypeDoc
Create a TCP connection from a device throught the network the device is currently connected to.