hmm thanks Tom.
Have used the public server in conductor-config-alice/&bob.toml.
but still running into some issues.
I launch the both instances for bob and alice and they launch fine:
holochain -c conductor-config-bob.toml
//same for alice.
Then I launch my programs on and try to connect via websocket on ws://localhost:3401 and 3402 but when I call a zome function from either side I get:
Encountered an error: connection refused
Enable a logger to see more information.
Initially when I run holochain -c conductor-config-alice I get:
Unlocking agent keys:
Unlocking key for agent 'alice':
conductor: boot_from_config
Reading DNA from dist/signal_agent.dna.json
Reading DNA from dist/signal_agent.dna.json
conductor: build_conductor_api instance_id=test-instance, config=Configuration { agents: [AgentConfiguration { id: "alice", name: "Alice", public_address: "HcSciaDXrXkqxwv7gukMChvazIuscvcrk457t8n88cmo95en4sPCEdDKvj4ucja", keystore_file: "alice.key", holo_remote_key: None, test_agent: Some(true) }], dnas: [DnaConfiguration { id: "hc-run-dna", file: "dist/signal_agent.dna.json", hash: "QmcMbGaekBvA2i63m9sUgRHuzQ8U7mr7DdUH9ejhnddsbV", uuid: None }], instances: [InstanceConfiguration { id: "test-instance", dna: "hc-run-dna", agent: "alice", storage: Memory }], interfaces: [InterfaceConfiguration { id: "websocket-interface", driver: Websocket { port: 3401 }, admin: true, instances: [InstanceReferenceConfiguration { id: "test-instance", alias: None }] }], bridges: [], ui_bundles: [], ui_interfaces: [], logger: LoggerConfiguration { logger_level: "debug", rules: LogRules { rules: [LogRule { pattern: .*, exclude: true, color: None }, LogRule { pattern: ^lib3h, exclude: false, color: None }, LogRule { pattern: ^holochain, exclude: false, color: None }, LogRule { pattern: ^lib3h, exclude: false, color: None }] }, state_dump: false }, network: Some(Sim2h(Sim2hConfig { sim2h_url: "wss://sim2h.holochain.org:9000" })), persistence_dir: "/home/simwilso/.config/holochain/conductor", signing_service_uri: None, encryption_service_uri: None, decryption_service_uri: None, dpki: None, signals: SignalConfig { trace: false, consistency: false }, passphrase_service: Cmd }
Reading DNA from dist/signal_agent.dna.json
Reading DNA from dist/signal_agent.dna.json
Failed to load instance test-instance from storage: ErrorGeneric("State could not be loaded due to NoneError")
Initializing new chain...
OBSERVATION - one weird thing about the above is that the ‘public address’ listed for Alice differs from the one that was produced when I ran keygen.
It didn’t work with the keygen value in conductor-alice.toml but doesn’t work either when I enter the one above in conductor-alice.toml either.
I got the same mismatch for bob so updated with the public key listed for him for the same command above.
For Alice my conductor-config toml looks like this:
[[agents]]
id = 'alice'
name = 'Alice'
keystore_file = 'alice.key'
public_address = 'HcSciaDXrXkqxwv7gukMChvazIuscvcrk457t8n88cmo95en4sPCEdDKvj4ucja'
test_agent = true
[[dnas]]
file = 'dist/signal_agent.dna.json'
hash = 'QmcMbGaekBvA2i63m9sUgRHuzQ8U7mr7DdUH9ejhnddsbV'
id = 'hc-run-dna'
[[instances]]
agent = 'alice'
dna = 'hc-run-dna'
id = 'test-instance'
[instances.storage]
type = "memory"
[[interfaces]]
admin = true
id = 'websocket-interface'
[[interfaces.instances]]
id = 'test-instance'
[interfaces.driver]
port = 3401
type = 'websocket'
[network]
type = 'sim2h'
sim2h_url = 'wss://sim2h.holochain.org:9000'
My Websocket call from my program for Alice looks like this:
fn get_from_dht(_address: String) -> String {
let json = serde_json::json!(
{"id": "0",
"jsonrpc": "2.0",
"method": "call",
"params": {"instance_id": "test-instance",
"zome": "spot_signal",
"function": "get_price",
"args": {"address": _address}}
});
let (tx, rx) = channel();
let tx1 = &tx;
connect("ws://localhost:3401", |out| {
// call an RPC method with parameters
out.send(json.to_string()).unwrap();
move |msg| {
//println!("Got message: {:#?}", msg);
tx1.send(msg).ok();
out.close(CloseCode::Normal)
}
}).unwrap();
rx.recv().unwrap().to_string() // set the value in the dht via websocket
}
`get_from_dht("HcSCII4B5M3P3RjggrNo7fv8jhOtkoqd553a7FwcTBPhidyoeJUfiFS98gnwyti".to_string());`
Does anything stick out as wrong in my config above to you?
It all seems to work ok with the test hc conductor and my hc test scenarios with bob and alice go ok.