$tesselwifi-n'Alan 的 AirPort Time Capsule'-p'PASSWORD'TESSEL!ConnectedtoTM-00-04-f000da30-00544741-1ca82586.INFOConnectingto"Alan 的 AirPort Time Capsule"withwpa2security...INFOAcquiringIPaddress...INFOConnected!IP192.168.1.46DNS168.95.192.1DHCP192.168.1.1Gateway192.168.1.1
var https =require('https');wifi.on('connect',function(data) {console.log("connect emitted", data);var json =JSON.parse('{"text":"This is a line of text in a channel.\nAnd this is another line of text."}');var postData ='payload='+JSON.stringify(json);var options = { hostname:'hooks.slack.com', port:443, path:'/services/T030MA704/B04MARY2F/clicTENx48f4h5v9OePzePkH', method:'POST', headers: {'Content-Type':'application/x-www-form-urlencoded','Content-Length':postData.length } };// Setup the request. The options parameter is// the object we defined above.var req =https.request(options,function(res) {res.setEncoding('utf-8');var responseString ='';res.on('data',function(data) { responseString += data; });res.on('end',function() {console.log(responseString); }); });req.on('error',function(e) {console.log('something error.'); });req.write(postData);req.end();}