Disconnection And Reset

When device is disconnected from the internet or calling close() will cause disconnection. Then onclose will be called.

Operations can't be delivered after disconnection, device or cloud will automatically reset the state.

When device disconnected from the internet.

By default, device resets after disconnection from the cloud.
It means the output value and pwm and other kind of states will all stop at that point.
But the below function with the argument true can nullify that default setting and change it to "do not reset when offline".
This configuration remains as long as obniz Board is on.

// Javascript Example


When obniz.js is disconnected from the cloud.

When program is ended, obniz.js connection to the cloud will be closed. Device is still connected to the cloud, then cloud will indicate reset to a device.

But another connection is still exist for same device, obniz cloud never reset the target.

This setting can be changed by providing below option. So device can keep IO state when your program finished.

// Javascript Example

var obniz = new Obniz("1234-5678", {reset_obniz_on_ws_disconnection: false})