What i'd like to achieve is setting the puck button press as a notifyer to my laptop.
I'm running a simples web server on http://127.0.0.1/5555/notify
And have tried
var options = {
host: '127.0.0.1', // host name
port: 5555, // (optional) port, defaults to 80
path: '/notify', // path sent to server
method: 'GET', // HTTP command sent to server (must be uppercase 'GET', 'POST', etc)
//headers: { key : value, key : value } // (optional) HTTP headers
};
require("ble_http").httpRequest(options, function(res) {
res.on('data', function(data) {
console.log("HTTP> "+data);
});
res.on('close', function(data) {
console.log("Connection closed");
});
});
The error i'm seeing in the terminal is:
Uncaught Error: Field or method "connect" does not already exist, and can't create it on undefined
at line 1 col 20
var b;return c.gatt.connect().then(function(a){console.log("...
^
in function "httpRequest" called from line 8 col 2
});
^
I'll freely admit i'm hacking from various examples and code so i'm not supprised it's not working ..
Is there an approach from the puck that would send a HTTP request to the paired host?
Espruino is a JavaScript interpreter for low-power Microcontrollers. This site is both a support community for Espruino and a place to share what you are working on.
What i'd like to achieve is setting the puck button press as a notifyer to my laptop.
I'm running a simples web server on
http://127.0.0.1/5555/notify
And have tried
The error i'm seeing in the terminal is:
I'll freely admit i'm hacking from various examples and code so i'm not supprised it's not working ..
Is there an approach from the puck that would send a HTTP request to the paired host?