HelloWorld
Wasm module and deployed it as a hosted service on the testnet peer 12D3KooWFEwNWcHqi9rtsmDhsYcDbRUCDXH84RC4FW6UfsFWaoHi
with service id 1e740ce4-81f6-4dd4-9bed-8d86e9c2fa50
. We can now extend our browser-to-browser messaging application with our hosted service.3-browser-to-service
directory in the VSCode terminal and install the dependencies:http://localhost:3000
. Following the instructions, we connect to any one of the displayed relay ids, open another browser tab also at http://localhost:3000
, select a relay and copy and paste the client peer id and relay id into corresponding fields in the first tab and press the say hello
button.aqua/getting_started.aqua
file in your IDE or terminal:HelloWorld
struct interface binding (6-8) for the hosted service from the marine aqua
exportHelloWorld
interface and function binding (11-12) for the hosted service from the marine aqua
exportHelloPeer
interface and function binding (15-16) for the local servicesayHello
(18-29)sayHello
function, let's look at why we still need a local service even though we deployed a hosted service. The reason for that lies in the need for the browser client to be able to consume the message sent from the other browser through the relay peer. With that out of the way, let's dig in:targetPeerId
, which is the client peer id of the other browser and the targetelayPeerId
, which is the relay id -- both parameters are the values you copy and pasted from the second browser tab into the first browser tabHelloWorld
on the host peer helloWorldPeerId
, which we specified in line 1HelloWorld
interface, on the peer helloWorldPeerId
, i.e.,12D3KooWFEwNWcHqi9rtsmDhsYcDbRUCDXH84RC4FW6UfsFWaoHi
, to the service id of the hosted service helloWorldServiceId
, i.e. 1e740ce4-81f6-4dd4-9bed-8d86e9c2fa50
, which takes the %init__peer__id% parameter, i.e., the peer id of the peer that initiated the request, and pushes the result into comp
(20-22)targetRelayPeerId
in the background as a co
routine.comp
result to the initiating browser