UNPKG

isock

Version:

Web -> Non-Web connectionusing Socket.io

21 lines (20 loc) 715 B
var isocks_client=require("isock")("secure")("client"); isocks_client({ server:"localhost", port:24681 },function(conn){ // server is ready and connection established conn.send("data"); // send data to server conn.rsend("data",function(reply_data){ // reply_data is the data that was sent back if server uses the reply method }); conn.on_disconnect(function(){ // client got disconnected from server }); conn.on_data(function(data){ // data is the data received from server // note this will not get data sent back // by reply is the client used rsend to send data }); conn.close(); // close the connection });