onveyor
Site menu
GitHub
Native Conveyor / Acknowledgment Native clients only

Acknowledgment

Acknowledgments let native Conveyor clients confirm receipt of server messages.

Enable acknowledgments

server.phpnative
<?php

use Conveyor\Constants;
use Conveyor\ConveyorServer;

require __DIR__ . '/vendor/autoload.php';

(new ConveyorServer())
    ->port(8989)
    ->conveyorOptions([
        Constants::USE_ACKNOWLEDGMENT => true,
        Constants::ACKNOWLEDGMENT_ATTEMPTS => 3,
        Constants::ACKNOWLEDGMENT_TIMOUT => 0.5,
    ])
    ->start();
USE_ACKNOWLEDGMENTtrue
ACKNOWLEDGMENT_ATTEMPTS3
ACKNOWLEDGMENT_TIMOUT0.5

Once enabled, outgoing pushed messages receive an id.

Acknowledge a message

jsonclient → server
{
  "action": "acknowledge-action",
  "data": "the-message-id"
}

The initial connection-info message also includes an id when acknowledgment is enabled.

Client responsibility

  • Store the message ids you receive.
  • Send the acknowledgment after the message has been processed.
  • Keep acknowledgment logic close to the message handling code, so dropped acknowledgments are easier to debug.