Module meshchat

Synopsis

Functions
meshchat.error()

Return an error page to a browser

meshchat.error(msg)

Return an error page to a browser.

Parameters
msg (string)

Error message to be displayed

API

Synopsis

Functions
meshchat.config()

Returns a JSON document with basic node configuration

meshchat.send_message()

Send a message to the MeshChat instance

meshchat.messages()

Return a list of message stored on the MeshChat instance

meshchat.sync_status()

Return a JSON document describing the sync status

meshchat.messages_raw()

Return a list of messages as text

meshchat.messages_md5()

Return the current MD5 has of the messages database

meshchat.messages_download()

Package the raw messages as the messages.txt file

meshchat.users_raw()

Return the list of users as raw text

meshchat.users()

Return a JSON document describing the logged in users

meshchat.local_files_raw()

Return a list of files as plain text

meshchat.file_download()

Return a specified file as a download

meshchat.files()

Return a JSON document describing the list of files

meshchat.delete_file()

Delete the specified file

meshchat.messages_version()

Return the current version string for the messages database

meshchat.messages_version_ui()

Return a JSON document of the messages database

meshchat.hosts()

Return a JSON document describing all the hosts

meshchat.hosts_raw()

Return a list of hosts as plain text

meshchat.upload_file()

Store a file into the file directory

meshchat.meshchat_nodes()

Return a list of nodes running MeshChat as text

meshchat.action_log()

Return a JSON document of the action log

meshchat.config()

Returns a JSON document with basic node configuration.

API Parameters

Parameter Required Description
action yes Must be set to config

API Response

Example
{
   "version": "meshchat_version",
   "node": "node_name",
   "zone": "meshchat_zone_name"
}
meshchat.send_message()

Send a message to the MeshChat instance.

API Parameters

Parameter Required Description
action yes Must be set to send_message
message yes Message body
call_sign yes Call sign of the sender
channel no Channel name to post message
epoch no Timestamp specified as unixtime
message

Needs to have newslines and double quotes escaped.

channel

If not specified or set to empty string will post message to Everything channel

epoch

If not specified, the current time on the MeshChat server will be used.

API Response

On a successful entry of the message into the database a success JSON document will be returned.

Example
{
  "status": 200,
  "response": "OK"
}
meshchat.messages()

Return a list of message stored on the MeshChat instance.

API Parameters

Parameter Required Description
action yes Must be set to messages
call_sign no Call sign of the requester
epoch no Timestamp specified as unixtime
id no Generated MeshChat ID

API Response

Example
{
  "id": "id_str",
  "epoch": epoch_time,
  "message": "message_text",
  "call_sign": "sending_call_sign",
  "node": "originating_node",
  "platform": "originating_node_platform",
  "channel": "channel"
}
meshchat.sync_status()

Return a JSON document describing the sync status.

API Parameters

Parameter Required Description
action yes Must be set to sync_status

API Response

Example
{
  "node": "node_name",
  "epoch": sync_time
}
meshchat.messages_raw()

Return a list of messages as text.

meshchat.messages_md5()

Return the current MD5 has of the messages database.

meshchat.messages_download()

Package the raw messages as the messages.txt file.

meshchat.users_raw()

Return the list of users as raw text.

meshchat.users()

Return a JSON document describing the logged in users.

API Parameters

Parameter Required Description
action yes Must be set to users

API Response

Example
{
  "id": "id_str",
  "epoch": epoch_time,
  "call_sign": "sender_call_sign',
  "node": "originating_node",
  "platform": "originating_platform",
}
meshchat.local_files_raw()

Return a list of files as plain text.

meshchat.file_download()

Return a specified file as a download.

API Parameters

Parameter Required Description
action yes Must be set to file_download
file yes Name of file to downlaod

API Response

Returns a page as an octet-stream that is tagged as an attachment to cause the browser to receive the file as a download.

meshchat.files()

Return a JSON document describing the list of files.

API Parameters

Parameter Required Description
action yes Must be set to files

API Response

Example
{
   "file": "filename",
   "epoch": modification_time,
   "size": file_size_in_bytes,
   "node": "originating_node",
   "platform": "originating_platform"
}
meshchat.delete_file()

Delete the specified file.

meshchat.messages_version()

Return the current version string for the messages database.

meshchat.messages_version_ui()

Return a JSON document of the messages database.

meshchat.hosts()

Return a JSON document describing all the hosts.

API Parameters

Parameter Required Description
action yes Must be set to hosts

API Response

Example
{
   "ip": "ip_address",
   "hostname": "hostname",
   "node": "node_name"
}
meshchat.hosts_raw()

Return a list of hosts as plain text.

meshchat.upload_file()

Store a file into the file directory.

meshchat.meshchat_nodes()

Return a list of nodes running MeshChat as text.

API Parameters

Parameter Required Description
action yes Must be set to meshchat_nodes
zone_name yes MeshChat zone name

API Response

The list of nodes and ports seperated by a tab.

Example
node1      8080
node2      8080
meshchat.action_log()

Return a JSON document of the action log.

Currently this call returns an empty list. In the future it will return a list of action log events.