Acknowledgment

Acknowledgments let native Conveyor clients confirm receipt of server messages.


Enable acknowledgments

1<?php
2
3use Conveyor\Constants;
4use Conveyor\ConveyorServer;
5
6require __DIR__ . '/vendor/autoload.php';
7
8(new ConveyorServer())
9    ->port(8989)
10    ->conveyorOptions([
11        Constants::USE_ACKNOWLEDGMENT => true,
12        Constants::ACKNOWLEDGMENT_ATTEMPTS => 3,
13        Constants::ACKNOWLEDGMENT_TIMOUT => 0.5,
14    ])
15    ->start();

When acknowledgment is enabled, outgoing pushed messages receive an id.

Acknowledge a message

The client replies with acknowledge-action and the message id:

1{
2  "action": "acknowledge-action",
3  "data": "the-message-id"
4}

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

Client responsibility

Native clients should store the ids they receive and send the acknowledgment after processing the message. If you build a custom client, keep this behavior close to the message handling code so dropped acknowledgments are easy to debug.