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="button" <# Ping button #> class="btn btn-primary">

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

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

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

<# start ping error #>
	document.getElementById('console').innerText += "\n\n ⇒ error: " + JSON.stringify(error);
<# end ping 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.