JSON-RPC Client & Server

This page uses a Hashtag JSON-RPC Form to provide a client for a Hashtag Worker.   The form is styled using Bootstrap 3 default theme classes.   JavaScript is used to update a text console as requests are processed.  

Console:



Processed this Hashtag Markup:
<# start json-rpc form using /json-rpc/server;
	set form.class to "form-inline";
#>

<input type="text" <# message #> placeholder="Message" class="form-control">
<input type="button" <# echo button #> class="btn btn-primary">

<# start echo request #>
	document.getElementById('console').innerText = "→ request: " + JSON.stringify(request);
<# end echo request #>

<# start echo response #>
	document.getElementById('console').innerText += "\n ← response: " + JSON.stringify(response);
<# end echo response #>

<# start echo result #>
	document.getElementById('console').innerText += "\n\n ⇒ result: " + JSON.stringify(result);
<# end echo result #>

<# start echo error #>
	document.getElementById('console').innerText += "\n\n ⇒ error: " + JSON.stringify(error);
<# end echo error #>

<# end form #>

<h4>Console</h4>
<div id="console" class="well"></div>
Hashtag Markup for Service Worker: /json-rpc/server
<# start json-rpc worker; #>

<# start echo #>
	<# set result.message to "<# params.message #>"; #>
<# end echo #>

<# start ping #>
	<# set result.message to "pong"; #>
<# end ping #>

<# end json-rpc worker #>

The Workers Mini-App uses the Hashtag Markup Language to demonstrate JSON-RPC services.

Both client-side interfaces and server-side methods are written in Hashtag Markup.