Closed michaelneale closed 1 year ago
I was able to look at code and see it would be message (would be nice to document that somewhere).
I then simplified my protocol:
var simpleMessageProtocol = {
"protocol": "http://simple-messaging-protocol3.xyz",
"types": {
"message": {
"schema": "http://simple-messaging-protocol3.xyz/schemas/message",
"dataFormats": ["text/plain"]
},
"messageResponse": {
"schema": "http://simple-messaging-protocol3.xyz/schemas/message-response",
"dataFormats": ["text/plain"]
}
},
"structure": {
"message": {
"$actions": [
{
"who": "anyone",
"can": "write"
},
{
"who": "recipient",
"of": "message",
"can": "read"
}
],
}
}
};
And was able to send from one user:
const { record } = await web5.dwn.records.create({
data: "Hello World!",
message: {
protocol: "http://simple-messaging-protocol3.xyz",
schema: "http://simple-messaging-protocol3.xyz/schemas/message",
protocolPath: "message"
},
});
var { status } = await record.send(client2);
console.log(status);
which was accepted.
however, when I tried to query it from another client (client2) (that it was sent to) with the following code:
// This invocation will query the user's own DWeb Nodes
const { records } = await web5.dwn.records.query({
message: {
filter: {
protocol: "http://simple-messaging-protocol3.xyz",
},
},
});
console.log(records);
results in no results and:
web5.ts:149 Sync failed due to error: Error: TODO: message not found
at bve.
here is some test code - run it at 2 seperate URLs so they get their own dids: https://gist.github.com/michaelneale/2e1e1a50444c5272784b29b7d457a414
Trying to setup a simple protocol like:
and trying to use that protocol:
I get an error:
records-write.ts:148 Uncaught Error:
protocoland
protocolPathmust both be defined or undefined at the same time
What is a protocolPath?