This is the ThingsDB documentation for version v0, click here for the latest version!

on-init

This event will be pushed on every request to watch a thing.

Example on-init event in JSON format:

{
    "event": 123,
    "collection": "stuff",
    "thing": {
        "#": 42,
        "name": "Iris"
    }
}

If the thing IS actually a collection, then the init event also contains all types and procedures inside the collection.

Example on-init event for a collection in JSON format:

{
    "event": 123,
    "collection": "stuff",
    "thing": {
        "#": 3
    },
    "types": [
        {
            "type_id": 1,
            "name": "Sample",
            "created_at": 1579592122,
            "modified_at": 1579592122,
            "fields": [
                ["name", "str?"]
            ],
            "methods": {},
            "wrap_only": false
        }
    ],
    "procedures": [
        {
            "doc": "Sample procedure",
            "name": "multiply",
            "created_at": 1579592122,
            "definition": "|a,b|{'Sample procedure';a*b;}",
            "with_side_effects": false,
            "arguments": ["a", "b"]
        }
    ]
}