@todo
Maybe any valid message could look like:
onmessage = event => {
const [lid, from, path, ref, type, body] = event.data
console.log(from)
// => e.g. `/wallet` or `/wallet/data-wallet-feature`? or any other capability
console.log(type) // => e.g. `"error"`, `"pay"`, `"get"` ... (meaning depends on `path`)
console.log(path)
// => e.g.`/dapp` or `/dapp/marketplace` or any other feature of the dapp
console.log(from, lid) // uniquely identifies a message
console.log(lid) // => lid>0, probably just a counter maintained by code around `from`
// it can be used by a sender to specifically "replay" to a previously received message
console.log(ref) // => a `lid` or a previous message where `from` was `path`
console.log(body) // => any kind of data that makes sense in the context of `type` & `path`
}
example scenarios
dapp requests payment confirmation from wallet and returns transaction response
- or
dapp listens to events and wallet sends a lot of "responses" over time every time
- user revokes access in
wallet and it sends a message about revoked access to dapp
- ....
"communication" - depending on wallet features - could be initiated by either:
- the
dapp
- the
wallet
every "protocol type" involves a certain amount of messages passing back and forth depending on what the communication is about and can be initiated and/or terminated by any party
so whether:
- an API (list of
methods/commands/querys/...) the wallet understands
- an API (list of
methods/commands/querys/...) the dapp understands
each method/command/query/... would:
- start with a message
- followed by 0 or more messages going back and forth
- until success or fail or e.g. in case of subscribing to an event, this might go on forever...
@todoMaybe any valid message could look like:
example scenarios
dapprequests payment confirmation fromwalletand returns transaction responsedapplistens to events andwalletsends a lot of "responses" over time every timewalletand it sends a message about revoked access todapp"communication" - depending on wallet features - could be initiated by either:
dappwalletevery "protocol type" involves a certain amount of messages passing back and forth depending on what the communication is about and can be initiated and/or terminated by any party
so whether:
methods/commands/querys/...) the wallet understandsmethods/commands/querys/...) the dapp understandseach
method/command/query/...would: