29 lines
910 B
Plaintext
Raw Normal View History

2021-07-20 14:00:26 +03:00
import "@fluencelabs/aqua-lib/builtin.aqua"
const HELLO_WORLD_NODE_PEER_ID ?= "12D3KooWFEwNWcHqi9rtsmDhsYcDbRUCDXH84RC4FW6UfsFWaoHi"
const HELLO_WORLD_SERVICE_ID ?= "1e740ce4-81f6-4dd4-9bed-8d86e9c2fa50"
2021-07-20 14:00:26 +03:00
2021-08-05 17:43:01 -05:00
data HelloWorld:
msg: string
reply: string
2021-07-20 14:00:26 +03:00
-- The service runs on a Fluence node
service HelloWorld:
2021-08-05 17:43:01 -05:00
hello(from: PeerId) -> HelloWorld
2021-07-20 14:00:26 +03:00
-- The service runs inside browser
service HelloPeer("HelloPeer"):
hello(message: string) -> string
2021-07-20 14:00:26 +03:00
func sayHello(targetPeerId: PeerId, targetRelayPeerId: PeerId) -> string:
-- execute computation on a Peer in the network
on HELLO_WORLD_NODE_PEER_ID:
HelloWorld HELLO_WORLD_SERVICE_ID
2021-08-05 17:43:01 -05:00
comp <- HelloWorld.hello(%init_peer_id%)
2021-07-20 14:00:26 +03:00
-- send the result to target browser in the background
on targetPeerId via targetRelayPeerId:
co HelloPeer.hello(%init_peer_id%)
2021-07-20 14:00:26 +03:00
-- send the result to the initiator
2021-07-20 14:00:26 +03:00
<- comp.reply