- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I am trying to do a simple connect using a public key to my server. I am unable to connect. The error thrown is: "Fail, error code is: 16, error message is: Server not accessible error"
The following is my code snippet:
var publicKey = "-----BEGIN PUBLIC KEY-----\n" +
"MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAlqSzFh5jWW/BzWfeS5gX\n" +
"5MjCnCZaZ/AFmo7RLou8lV3Ue6Pjdpqcf3T9Ul9X5Cj1TPq5mzAleo5DR8il+7mp\n" +
"tWLZ5SqTNB3N40E9UtN6dqVky7rCvU6/rDEH+BOydBFDTP02j78gdD/tneuZnVT3\n" +
"TMV9fSiqX5CdunyzLc8gaVtpr1c1VoGH641z7+0VRmsl9iIuxQu1Vgt8QojioOr0\n" +
"/pH8O7sTlobKf7rbuwKKP7xxU2zNWXqHE7IZWhbKo0zmB9MDH1YmxCAnGup7gvPD\n" +
"sxOWjp5JTGV8clEYr4f0KgvnvCCIarRliEFfdSnYYKlafoOx4KSc75tN69nONQYn\n" +
"QQIDAQAB\n" +
"-----END PUBLIC KEY-----\n";
// options for the transport creation call
var openOptions = {
url: "https://104.155.25.147:8181/DeliveryReport/privatewealth/register",
serverKey: publicKey
};
// create the Transport Secure instance
intel.security.secureTransport.open(
function(instanceID) {
// options for the request send.
var sendRequestOptions = {
instanceID: instanceID,
requestBody: "data to send"
};
// send the HTTPS request
intel.security.secureTransport.sendRequest(
function(response) {
// assign response HTTP status
var responseHttpStatus = response.responseHttpStatus;
// assign response body
var responseBody = response.responseBody;
// assign response header
var responseHeader = response.responseHeader;
/*
now we have the following items:
* Transport Secure instance ID at 'transportInstanceId'
* the response body at 'responseBody'
* the response header at 'responseHeader'
we can use it in our code.
*/
console.log("response"+response);
doSomethingAfterReceiveWithKeyPinning(response);
},
failCallback,
sendRequestOptions);
},
failCallback,
openOptions);
function failCallback(error) {
console.log("Fail, error code is: " + error.code + ", error message is: " + error.message);
}
- Tags:
- HTML5
- Intel® XDK
Link Copied
1 Reply
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Are you getting this error from a built app or from the Emulator or Debug tabs? If from a built app you might need to update the whitelist settings for your app, on the Projects tab.
Reply
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page