-
Notifications
You must be signed in to change notification settings - Fork 19
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Publish doesn't send messages #45
Comments
Yes your understanding is correct, but subscribe takes some time (usually less than one block interval, i.e. 20s) to be effective because it is an on-chain operation (that's why it's in wallet). publish is an off-chain operation, so once subscriber info is recorded on-chain, publish will be instant |
I don't see any messages getting sent even when the response On a related note, could you please set the publish method to return the response object, instead of nothing. |
You are right, recently metadata is added to subscriber info so it's not parsing correctly. It's fixed in #47 now. Here is a working example:
60s is usually enough, but in some cases it may take longer because the txn may be packed in a later block, plus block interval can be increased from 20s to 60s in some cases. Publish is a one-to-many message and thus does not support reply, otherwise it may be used to perform DDoS attack. It may throw error though. |
Yeah, it works now, but it also has a bug. The // rpc.js
module.exports = rpcCall;
async function rpcCall(addr, method, params = {}) {
let response = await fetch(addr, {
method: 'POST',
body: JSON.stringify({
jsonrpc: "2.0",
method: method,
params: params,
}),
})
let data = await response.json();
return data;
} So sometimes it returns {
error: { code: -42002, message: "INVALID PARAMS" },
id: "1",
jsonrpc: "2.0",
} And then I get You can test it like this sendingClient.on('connect', () => {
setTimeout(() => {
console.log('publish');
sendingClient.publish(null, 0, 'hello world') // null topic is illegal
}, 60 * 1000);
}) But this wasn't a bug in the code, but a mistake on my part, huh. so it works correctly now, I guess. |
Fixed in #49 (in ed25519 branch instead of master though) |
Hi,
I don't think the publish is working correctly.
This makes a request where it gets a result like
{"id":"1","jsonrpc":"2.0","result":{"identifier.02c988e6a672fd6b8cf42e68682362ee152a8afb5176b9206c558b4cb89daba47d":"","identifier.0352304707e0af0187b435ea5f3ec8f3a0fbac71e3e801dbc34b3cf8d4000d1128":"","identifier.03c7575885c10f141576d817fa5fbca5144e74e3fd85838530ec8a8027d587aa5a":""}}
But then nothing gets sent to them afterwards. My understanding was that it is a shortcut to send the message to all those addresses automatically.
The text was updated successfully, but these errors were encountered: