shh_post
发送whisper消息。
参数
Object
- whisper的post对象,结构如下:
- from: DATA, 60 Bytes - 发送方编号,可选
- to: DATA, 60 Bytes - 接收方编号,可选。当使用该参数时,whisper将加密消息,只有接收方可以解密
- topics: Array of DATA - 主题数组,用于接收方识别消息
- payload: DATA - 消息的载荷
- priority: QUANTITY - 消息优先级
- ttl: QUANTITY - 消息存活时长,单位:秒
params: [{
from: "0x04f96a5e25610293e42a73908e93ccc8c4d4dc0edcfa9fa872f50cb214e08ebf61a03e245533f97284d442460f2998cd41858798ddfd4d661997d3940272b717b1",
to: "0x3e245533f97284d442460f2998cd41858798ddf04f96a5e25610293e42a73908e93ccc8c4d4dc0edcfa9fa872f50cb214e08ebf61a0d4d661997d3940272b717b1",
topics: ["0x776869737065722d636861742d636c69656e74", "0x4d5a695276454c39425154466b61693532"],
payload: "0x7b2274797065223a226d6",
priority: "0x64",
ttl: "0x64",
}]
返回值
Boolean
- 如果消息发出则返回true,否则返回false
示例代码
请求:
curl -X POST --data '{"jsonrpc":"2.0","method":"shh_post","params":[{"from":"0xc931d93e97ab07fe42d923478ba2465f2..","topics": ["0x68656c6c6f20776f726c64"],"payload":"0x68656c6c6f20776f726c64","ttl":0x64,"priority":0x64}],"id":73}'
响应:
{
"id":1,
"jsonrpc":"2.0",
"result": true
}