-
Notifications
You must be signed in to change notification settings - Fork 7
Open
Labels
discussionCommunity discussion is encouragedCommunity discussion is encouraged
Description
icrc: 12
title: ICRC-12 Canister Events
author: Hazel Rowell <hazel@departure.dev>,
discussions-to: https://github.com/dfinity/ICRC/issues/12
status: Deliberating
category: ICRC
requires: None
created: 2023-02-26
updated: 2023-02-26
Moving from the forum to continue discussion.
Summary
A minimum set of types and methods to facilitate the development of event driven systems on the IC.
Introduction
This proposal aims to enable the development of event-driven systems on the IC by introducing a set of types and methods. Our approach in this proposal is omnibus. We propose the use of the PublisherMessage, which can contain either a PublisherNotification or an Event. The Event is loosely self-describing with the help of the event_schema property. Our goal is to provide a framework that is tight enough to allow developers to start publishing and subscribing immediately while being flexible enough to accommodate future scaling needs.
Publisher
icrc12_subscribe & icrc12_unsubscribe
type SubscriptionError = variant {
NotAuthorized;
};
type SubscriptionResponse = variant {
Ok : null;
Err : opt SubscriptionError;
};
type Publisher = service {
icrc12_subscribe : (handler : (PublisherMessage) → ()) → (SubscriptionResponse);
icrc12_unsubscribe : (handler : (PublisherMessage) → ()) → (SubscriptionResponse);
}
Subscriber
icrc12_handler
type Event = record {
event_schema : text;
event_type : text;
created_at : nat64;
data : vec nat8;
};
type PublisherNotification = variant {
NewSender : record {p : principal};
};
type PublisherMessage = variant {
Event : Event;
Notification : opt PublisherNotification;
};
type Subscriber = service : {
icrc12_handler: (PublisherMessage) -> ();
}
BXSWSSMBDX and fredericrous
Metadata
Metadata
Assignees
Labels
discussionCommunity discussion is encouragedCommunity discussion is encouraged