I haven't been able to connect to cloudsocket.hologram.io using a modified NBWebClient.ino example. The code worked on three other websites using port 80 including the Arduino example. Here's the code I used as described at the hologram.io site.
https://hologram.io/docs/reference/cloud/embedded/#examples
It connects to the network but not the server.
#include <MKRNB.h>
const char PINNUMBER[] = "";
String HOLOGRAM_DEVICE_KEY = "MYKEY";
String HOLOGRAM_MESSAGE = "MESSAGE";
String HOLOGRAM_TOPIC="MYTOPIC";
NBClient client;
GPRS gprs;
NB nbAccess;
char server[] = "cloudsocket.hologram.io";
unsigned int port = 9999;
void setup() {
Serial.begin(9600);
Serial.println("NBWebClient");
while (!Serial) {
; // wait for serial port to connect. Needed for native USB port only
}
Serial.println("Starting Arduino web client.");
boolean connected = false;
// After starting the modem with NB.begin()
while (!connected) {
if ((nbAccess.begin(PINNUMBER,true) == NB_READY) &&
(gprs.attachGPRS() == GPRS_READY)) {
connected = true;
Serial.println("Network connected");
} else {
Serial.println("Not connected");
delay(1000);
}
}
Serial.print("connecting to server: ");
Serial.print(server);
Serial.print(":");
Serial.println(port);
if (client.connect(server, port)) {
Serial.print("connected to ");
Serial.println(server);
// Send a Message request:
client.println("{"k":"" + HOLOGRAM_DEVICE_KEY + "","d":""+ HOLOGRAM_MESSAGE + "","t":""+ HOLOGRAM_TOPIC +""}");
I didn't include the rest since the connection fails before it can send the message. Here's the Serial Monitor result:
Starting Arduino web client.
Network connected
connecting to server: cloudsocket.hologram.io:9999
connection failed
disconnecting.
Does anyone have recent experience getting this working? I tried code from someone who had it working earlier this year but that stalled on the server connection too.