当使用生产导体(即使用holochain -c hcconfig.toml)运行holochain应用时,
如何使用@holochain/hc-web-client (v0.5.0)查询前端的实例?
我试过:
import { connect } from "@holochain/hc-web-client";
const opts = {
url: "ws://localhost:8888"
};
const hConn: HoloConn = await connect(opts);
const { call } = hConn;
const info = await call("info", "instances")();
console.log({ info });这似乎适用于开发导体(即hc run),

但是当我切换到生产导体时,它会在相同的位置返回一个空数组。
有什么是我需要改变使这项工作与生产指挥?
这是我的导体配置:
bridges = []
[[agents]]
id = "alice"
name = "alice"
keystore_file = "/tmp/hc/keys/alice.key"
public_address = "HcSCj9wvVKj7ryhm9ttRansEX5Zyk5ac4QOFK59sowZzrw36s6NuTSeDtn6oiui"
[[agents]]
id = "bob"
name = "bob"
keystore_file = "/tmp/hc/keys/bob.key"
public_address = "HcSCj7r458cQcxSkfwSa3S6myv7Mv5ukwSc4IP6fg8yYwoevVbFnY4dAO4e3dyz"
[[dnas]]
id = "tender"
file = "dist/hc-201906.dna.json"
[[instances]]
id = "instance_alice"
agent = "alice"
dna = "tender"
[instances.storage]
path = "/tmp/hc/instance_alice.storage"
type = "file"
[[instances]]
id = "instance_bob"
agent = "alice"
dna = "tender"
[instances.storage]
path = "/tmp/hc/instance_bob.storage"
type = "file"
[[interfaces]]
id = "websocket interface"
admin = true
[interfaces.driver]
port = 8888
type = "websocket"
[logger]
type = "debug"
[[logger.rules.rules]]
color = "red"
exclude = false
pattern = "^err/"
[[logger.rules.rules]]
color = "white"
exclude = false
pattern = "^debug/dna"
[[logger.rules.rules]]
exclude = false
pattern = ".*"发布于 2019-07-08 16:47:24
问题在于导体的配置:
在websocket接口定义中,缺少的是通过该接口公开实例的链接:
[[interfaces.instances]]
id = "instance_alice"
[[interfaces.instances]]
id = "instance_bob"完整的配置如下所示:
bridges = []
[[agents]]
id = "alice"
name = "alice"
keystore_file = "/tmp/hc/keys/alice.key"
public_address = "HcSCjoZM6f4C3pe684umUf65KWVu8oqecZhwYeySVaxytowvFN777VbQxyCyopa"
[[agents]]
id = "bob"
name = "bob"
keystore_file = "/tmp/hc/keys/bob.key"
public_address = "HcSCIE6abINr5ojy7o8xp7fjMJjG4au67GU34QQjbkHg6prdhfYo9XyjVymsrdr"
[[dnas]]
id = "tender"
file = "dist/hc-201906.dna.json"
[[instances]]
id = "instance_alice"
agent = "alice"
dna = "tender"
[instances.storage]
path = "/tmp/hc/instance_alice.storage"
type = "file"
[[instances]]
id = "instance_bob"
agent = "alice"
dna = "tender"
[instances.storage]
path = "/tmp/hc/instance_bob.storage"
type = "file"
[[interfaces]]
id = "interface_websocket"
admin = true
[interfaces.driver]
port = 8888
type = "websocket"
[[interfaces.instances]]
id = "instance_alice"
[[interfaces.instances]]
id = "instance_bob"
# ----------- UI -----------
[[ui_bundles]]
id = "bundle_ui"
root_dir = "./web-ui/build"
[[ui_interfaces]]
id = "ui_interface"
bundle = "bundle_ui"
port = 8908
dna_interface = "interface_websocket"
# ----------- Logging -----------
[logger]
type = "debug"
[[logger.rules.rules]]
color = "red"
exclude = false
pattern = "^err/"
[[logger.rules.rules]]
color = "white"
exclude = false
pattern = "^debug/dna"
[[logger.rules.rules]]
exclude = false
pattern = ".*"https://stackoverflow.com/questions/56902271
复制相似问题