Obyte developer resources
GitHubObyte.jsObyte.org
  • Quick Start
  • Configuration
  • Tutorials for newcomers
    • Setting up headless wallet
    • Ping-pong paymets
    • Logging into website
    • Weather oracle
    • Bet on weather bot
  • Payments and transactions
    • Textcoins
    • Sending data to DAG
  • Contracts
    • Smart contracts
    • Smart contract language reference
    • Prosaic contracts
    • Contracts with arbitration
  • Autonomous Agents
    • Getting started guide
    • Oscript language reference
  • Issuing assets on Obyte
  • Attestation profiles / KYC
  • Address signing/verification
  • URI protocol
  • Events list
  • Websocket API
    • Request
    • JustSaying
  • Obyte for merchants
    • Payments gateway
    • Cashback API
  • JSON-RPC
    • Exposing RPC interface
    • Running RPC service
  • Libraries and Scripts
Powered by GitBook
On this page
  • Send version information
  • Send free joints
  • Send a private transaction
  • Share your node WebSocket URL to accept incoming connections
  • Ask to verify your WebSocket URL
  • Verify your WebSocket URL with echo message
  • Log in to Hub
  • Get new messages
  • Remove handled message
  • Send pairing message
  • Send message to device
  • Ask more messages
  • Light wallet transaction update
  • Light wallet sequence became bad
  • Add light wallet to monitor address
  • Send bug report
  • Push project number (only accepted from hub)
  • New version is available (only accepted from hub)
  • Exchange rates (only accepted from hub)
  • Ask to update (only accepted from hub)
  • Watch system variables
  • Custom JustSaying

Was this helpful?

Export as PDF
  1. Websocket API

JustSaying

This is a message type, which doesn't require response back.

Example:

const network = require('ocore/network.js');
const eventBus = require('ocore/event_bus.js');
const ws = network.getInboundDeviceWebSocket(device_address);

// function parameters: websocket, subject, body
network.sendJustsaying(ws, 'custom', 'some data');

eventBus.on('custom_justsaying', function(ws, content) {
    console.log(content);
};

Following is a list of justsaying type JSON messages that are sent over the network:

Send version information

{
    type: 'justsaying',
    content: {
        subject: 'version', 
        body: {
            protocol_version: protocol_version, 
            alt: alt, 
            library: name, 
            library_version: version, 
            program: program, 
            program_version: program_version
        }
    }
}

Send free joints

{
    type: 'justsaying',
    content: {
        subject: 'free_joints_end', 
        body: null
    }
}

Send a private transaction

{
    type: 'justsaying',
    content: {
        subject: 'private_payment', 
        body: privateElement
    }
}

Share your node WebSocket URL to accept incoming connections

{
    type: 'justsaying',
    content: {
        subject: 'my_url', 
        body: my_url
    }
}

Ask to verify your WebSocket URL

{
    type: 'justsaying',
    content: {
        subject: 'want_echo', 
        body: random_echo_string
    }
}

Verify your WebSocket URL with echo message

{
    type: 'justsaying',
    content: {
        subject: 'your_echo', 
        body: echo_string
    }
}

Log in to Hub

{
    type: 'justsaying',
    content: {
        subject: 'hub/login', 
        body: {
            challenge: challenge,
            pubkey: pubkey,
            signature: signature
        }
    }
}

Get new messages

{
    type: 'justsaying',
    content: {
        subject: 'hub/refresh', 
        body: null
    }
}

Remove handled message

{
    type: 'justsaying',
    content: {
        subject: 'hub/delete', 
        body: message_hash
    }
}

Send pairing message

{
    type: 'justsaying',
    content: {
        subject: 'hub/challenge', 
        body: challenge
    }
}

Send message to device

{
    type: 'justsaying',
    content: {
        subject: 'hub/message', 
        body: {
            message_hash: message_hash,
            message: message
        }
    }
}

Ask more messages

{
    type: 'justsaying',
    content: {
        subject: 'hub/message_box_status', 
        body: 'has_more'
    }
}

Light wallet transaction update

{
    type: 'justsaying',
    content: {
        subject: 'light/have_updates', 
        body: null
    }
}

Light wallet sequence became bad

{
    type: 'justsaying',
    content: {
        subject: 'light/sequence_became_bad', 
        body: arrUniqueUnits
    }
}

Add light wallet to monitor address

{
    type: 'justsaying',
    content: {
        subject: 'light/new_address_to_watch', 
        body: address
    }
}

Send bug report

{
    type: 'justsaying',
    content: {
        subject: 'bugreport', 
        body: {
            message: message,
            exception: exception
        }
    }
}

Push project number (only accepted from hub)

{
    type: 'justsaying',
    content: {
        subject: 'hub/push_project_number', 
        body: {
            projectNumber: projectNumber
        }
    }
}

New version is available (only accepted from hub)

{
    type: 'justsaying',
    content: {
        subject: 'new_version', 
        body: {
            version: version
        }
    }
}

Exchange rates (only accepted from hub)

{
    type: 'justsaying',
    content: {
        subject: 'exchange_rates', 
        body: exchangeRates
    }
}

Ask to update (only accepted from hub)

{
    type: 'justsaying',
    content: {
        subject: 'upgrade_required', 
        body: null
    }
}

Watch system variables

{
    type: 'justsaying',
    content: {
        subject: 'watch_system_vars', 
        body: null
    }
}

This will subscribe you to updates of the currently active system variables and votes for them.

Immediately after this request, you'll get the current state of all system variables and their past values with the MCIs when they were voted in:

{
    type: 'justsaying',
    content: {
        subject: 'system_vars', 
        body: {
            op_list: [
                {
                    vote_count_mci: 123,
                    is_emergency: 0,
                    value: [
                        "2FF7PSL7FYXVU5UIQHCVDTTPUOOG75GX",
                        ....
                    ]
                },
                .....
            ],
            threshold_size: [
                {
                    vote_count_mci: 456,
                    is_emergency: 0,
                    value: 10000
                },
                .....
            ],
            .....    
        }
    }
}

Similar data will be pushed to you whenever any system variable changes as a result of vote count.

Also, user votes will be pushed to you as soon as they are sent by users (first, with is_stable=0, then with is_stable=1 as soon as the voting transaction becomes final):

{
    type: "justsaying",
    content: {
        subject: "system_var_vote", 
        body: {
            subject: "op_list",
            value: [
                "2FF7PSL7FYXVU5UIQHCVDTTPUOOG75GX",
                ....
            ],
            author_addresses: ["EJC4A7WQGHEZEKW6RLO7F26SAR4LAQBU"],
            unit: "LpxhHEfxbOyj0sPlp6UC6XrRABvRJiH4qKEsOcMd1Bc=",
            is_stable: 1
        }
    }
}

Custom JustSaying

{
    type: 'justsaying',
    content: {
        tag: tag,
        subject: 'custom',
        body: body
    }
}
PreviousRequestNextObyte for merchants

Last updated 7 months ago

Was this helpful?

You can add your own communication protocol on top of the Obyte one. See event .

there