Create connection via calling Transport with IP
const transport = Transport('192.168.1.1');
To write a message over the socket use write, this will return a promise. The promise will only resolve if an ack is recieved.
transport.write('Hello how are you doing').then(() => {
console.log('message sent properly');
});
You can listen to message from the server through .listen, this is a callback with the message.
transport.listen((message) => {
console.log('Message from server', message);
});
to disconnect do disconnect :D
transport.disconnect()