Open terrorgeek opened 5 years ago
Looks like your friend isn't able to connect. You'll have to make sure your node is accessible from your friend's network, e.g. by moving your node to a DigitalOcean or AWS server, or by forwarding your node's RPC port.
@mappum Thanks, I verified that both machine can ping each other by using 'ping' command, so right now if I run the client it gives me:
Error: connect ECONNREFUSED 127.0.0.1:40291 at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1085:14)
the port 40291 is the blockchain server's RPC port so maybe it's connected but the client still take the remote machine as 127.0.0.1 which is still not correct. So to let client know the blockchain server's IP address do we need to do something when we initiate the blockchain? maybe like:
let app = lotion({ initialState: { count: 0 }, host: "10.0.20.44" //server's IP address });
Interesting, that might be a bug. You can make the client manually specify an address in lotion connect like this:
connect('GCI', {
nodes: [ 'ws://<NODE_HOST>:<RPC_PORT>' ]
})
Hi lotionjs team,
I have very simple quesiton. Basically I'm running the example app(the counter app) on my machine and I want my friend to use another machine to connect to it. As I can get the GCI when started the sample app and give it my friend, and my frienis using the below code in a different machine: let { connect } = require('lotion') const GCI = "the one that got from sample app and gave to my friend"; async function main(){ let { state, send } = await connect(GCI)
// query state, this is what would have been at http:// localhost:3000/state before console.log(await state)
// create tx (previously POST http://localhost:3000/txs) console.log(await send({ foo: 'bar' })) }
main()
But seems it's not working, no state acquired and no new transaction sent and the client(above code) stuck. Is that suppose to connect 2 machines by knowing their IP? or how can I use one machine to connect another machine that is running a blockchain and query its status and send new transactions to it?
Thank you very much.