Affinity M-Queue
The following workflow describes basic methods for processors in Async360.
var tokenResp = await Request(get_envoy_token, client);
var mydata = new ApeUserData
{
ClientTaskID = tokenResp.task_id,
OrderID = Order.LineID
};
var req = new SubscibeRequest
{
address = Order.PaymentAddress,
include_data = (mydata).ToB64(),
network = "btc",
queue_name = "my-checkout"
};
await Request(api_methods.subscribe, req);
Subscribe unlimited addresses; use your extended public keys to locally derive new and unique deposit addresses with every payment instance.
var websocket = new WebSocket("wss://env.async360.com/");
websocket.addEventListener("open",
function (event) {
websocket.send(
JSON.stringify({ClientToken: token})
);
});
websocket.addEventListener("message",
function (e) {
var obj = JSON.parse(e.data);
var message = obj.Message;
if (message) {
updateCallback(message);
}
});
Apeshift Envoy is deployed here to browsers, allowing the remote process (below) to enjoy client response alongside its persistent M-Queue connection.
var mydata = (ApeUserData)mq.UserData.FromB64();
var myResp = new ClientConfirmResponse()
{
transaction = mydata.OrderID
};
var req = new InvokeEnvoyRequest
{
new_timeout = 0,
message = (myResp).ToB64(),
task_id = mydata.ClientTaskID
};
await Request(api_methods.invoke_envoy, req);
API Methods
method
create_blockchain_mq
Create a network queue to initiate a dedicated and persistent Blockchains MQ socket.
request
"Params":{
"queue_name":"checkout"
}
response
{
"id": "2",
"jsonrpc": "2.0",
"error": null,
"result": {
"connection_string": "trNDsob9yUnztWgw3txXFFuO3M....."
}
}
include_data
A user defined value to help identify this scenario.
method
subscribe
Add an address to your blockchain network queue.
request
"Params":{
"network":"btc",
"address":"3LUpbPG3Dfz7nmV4DfT2VjYtNj3LNj8X49",
"queue_name":"checkout",
"include_data":"YOUR-BASE64-STRING"
}
response
{
"id": "2",
"jsonrpc": "2.0",
"error": null,
"result": {
"status":"success"
}
}
include_data
Any user defined data which should be returned with your blockchain network events for this address, such as client context or task for later use when invoking an Apeshift Envoy.