Offbeat Iot
Get started
Reuse credentials across devices

Reuse credentials across devices

If you are programming in arduino (or other c++ microcontrollers, I guess)

File with wifi credentials

Create this file in your library folder alongside your other libraries downloaded by arduino

library/credentials/wifiCredentials.h
#pragma once
const char* mySSID = "the name of your wifi network";
const char* myPASSWORD = "the password for your wifi network";

Create a new user in the user interface

User creation

and add its credentials to the file below

library/credentials/exampleCredentials.h
#pragma once
const char* offbeatIotUser= "the user you created in the browser";
const char* offbeatIotPassword= "the users password";

then, when importing the credentials file, the constants will be available in code

WebSocket URL

Connect to the Offbeat IoT WebSocket at:

wss://www.offbeat-iot.com/ws?device=YOUR_DEVICE_ID

Or alternatively:

wss://www.offbeat-iot.com/name?device=YOUR_DEVICE_ID

Define the host and path in your sketch:

char host[] = "www.offbeat-iot.com";
char path[] = "/ws?device=YOUR_DEVICE_ID";
using user credentials in a separate header file
import exampleCredentials.h
....
webSocketClient.begin(host, 443, path);
webSocketClient.setExtraHeaders("Accept=application/json");
webSocketClient.setAuthorization(offbeatIotUser, offbeatIotPassword);
Examples