Skip to main content

server

Availability

Device

Description

The server object is a singleton which provides functionality for controlling and communicating with the Electric Imp impCloud™ server. It is instantiated automatically when the Squirrel virtual machine starts. A connection to the server is required for the device to communicate with its agent, but the server object does not refer to the agent itself, rather to the infrastructure which supports the agent. To interact with the agent specifically, use the agent object.

All methods that send data to the server return 0 on success, or a Send Error Code:

Error Code Constant Value Description
SEND_ERROR_NOT_CONNECTED 1 There is no connection to the server
SEND_ERROR_TIMEOUT 2 The timeout expired before all the data was sent to the server
SEND_ERROR_DISCONNECTED 3 The connection was disconnected before all data was sent to the server
SEND_ERROR_WOULDBLOCK 4 The data to be sent would not fit in the send buffer (from impOS™ 38)

The values assigned to the constants may change in a future impOS release.

Member Entities

The server object has the following member methods:

The server object also has the following deprecated member methods, which should not be used in new code, but are documented here as an aid to understanding and migrating old code:

The server object also has the following deprecated member property, which should not be used in new code, but are documented here as an aid to understanding and migrating old code:

  • server.permanent()A table of permanent values passed between imp and agent at boot time