User/client interaction modes

Although running curl commands is sufficient to test our web application, the proper way to expose the application to the user would be through one or more web pages, with widgets for the user to trigger those commands.

As we saw in the middleware implementation section, various operations, including chaincode invocations, are asynchronous. In our implementation, we masked this asynchronous behavior by making the wrapper function return to the caller, but only when the request had been successfully sent to the orderer and the events subscribed for had been received and validated. We can also choose to expose this asynchronous behavior to the web application client. Using Web Sockets (https://developer.mozilla.org/en-US/docs/Web/API/WebSockets_API), the contents of a web interface presented to the end user may be dynamically updated whenever the event notification arrives at the callback registered with the event hub.

Designing good web interfaces is beyond the scope of this book, and it is left to the reader to leverage other sources of knowledge to build ones suitable for their applications.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.119.142.232