UNPKG

isock

Version:

Web -> Non-Web connectionusing Socket.io

22 lines (21 loc) 731 B
var isocks_server=require("isock")("secure"); server=isocks_server(); server.on_connect((socket)=>{ // new socket connected }); server.on_data((socket,data,reply)=>{ // socket is the socket obviously // data is the data incomming, as either a string or object if JSON /* reply(<data>) This is special, because sometimes the client wants a direct reply wether or not it sent a reply status, this function will just send back any data you provide */ }); server.on_disconnect((socket)=>{ // socket disconnected }); // server.get_socket(<id>); // return a socket by its id // server.list_sockets(); // returns a list of all sockets id's server.start(24681);