Skip to content

Commit 621e6f2

Browse files
committed
subscriptions Id
subscriptions now have a Id. If an Id is passed in as an attribute in the initial request, that will become the id, which is a bug and a feature.
1 parent 9bf913c commit 621e6f2

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

packages/pico-engine/krl/io.picolabs.subscription.krl

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ ent:established [
6969
},...,...
7070
]
7171
*/
72-
wellknown_Policy = {
72+
wellknown_Policy = { // we need to restrict what attributes are allowed on this channel, specifically Id.
7373
"name": "wellknown",
7474
"event": {
7575
"allow": [
@@ -122,12 +122,14 @@ ent:established [
122122
random:word()
123123
}
124124
pending_entry = function(){
125-
roles = event:attr("Rx_role").isnull() => {} | {
125+
roles = event:attr("Rx_role").isnull() => {} | { // add possible roles
126126
"Rx_role" : event:attr("Rx_role"),
127127
"Tx_role" : event:attr("Tx_role")
128128
};
129-
event:attr("Tx_host").isnull() =>
130-
roles | roles.put(["Tx_host"] , event:attr("Tx_host"))
129+
_roles = event:attr("Tx_host").isnull() => // add possible host
130+
roles | roles.put(["Tx_host"] , event:attr("Tx_host"));
131+
event:attr("Id").isnull() => // add subscription identifier
132+
_roles.put(["Id"], random:uuid()) | _roles.put(["Id"], event:attr("Id"))
131133
}
132134

133135
}

0 commit comments

Comments
 (0)