Converting from MiServer 3.1 to HTMLRenderer

MiServer is Dyalog's APL-based web development framework

Converting from MiServer 3.1 to HTMLRenderer

Postby ray on Thu Sep 02, 2021 5:06 pm

For some years now, I have been developing graphical code to run using MiServer to provide a front end on my browser, using HTML5, SVG, AJax, and JavaScript all built in APL.

MiServer is a bit of a black box to me, but in "Hex" (my MiServer class), I have a "top level function" with the standard name of "Compose", and second named "APLJax", that I know both pass text through MiServer to the browser. This text is "pre-processed" via one of two MiServer functions: "Execute" and "Replace". My code calls no other MiServer function (such as "Add").

Should I be able to "do away" with MiServer and use the HTMLRenderer in its place so long as I only want to use a local browser (that is http://127.0.0.1:8080/hex).

How should I go about doing this, where would I place HTMLRenderer and what would I need to replace "Execute" and "Replace" with?

I feel this should be very easy, or am I being naïve as what I need to do is far more complex than just injecting a few extra commands/functions here and there?
Ray Cannon
Please excuse any smelling pisstakes.
User avatar
ray
 
Posts: 192
Joined: Wed Feb 24, 2010 12:24 am
Location: Blackwater, Camberley. UK

Re: Converting from MiServer 3.1 to HTMLRenderer

Postby ray on Thu Sep 02, 2021 5:17 pm

Correction, APLJax is a sub function of Compose and MiServer has direct interaction with it.
Sorry about that.

Ray
Ray Cannon
Please excuse any smelling pisstakes.
User avatar
ray
 
Posts: 192
Joined: Wed Feb 24, 2010 12:24 am
Location: Blackwater, Camberley. UK

Re: Converting from MiServer 3.1 to HTMLRenderer

Postby Brian|Dyalog on Fri Sep 03, 2021 3:22 pm

Hi Ray!

The HTMLRenderer is not an HTTP server (so, you can't point a browser at it). It's an HTML rendering object (very much like a browser) that uses CEF (Chromium Embedded Framework).

In this case you probably want to use DUI https://github.com/Dyalog/DUI. DUI is a dual-paradigm HTML/HTTP server. This means that you should be able to run your MiServer MiSite either with MiServer (which is built into DUI) or with HRServer (which is an HTMLRenderer-based component and also built into DUI). HRServer is essentially MiServer, but instead of talking to a browser, it talks to HTMLRenderer.

To get started:

Clone the DUI repository (or download and unzip the zip file). For the purposes of this discussion, let's suppose you've put DUI in a folder named /git/DUI and your MiSite is in a folder named /MiSites/site1.

I noticed that you're invoking your MiSite by going to the "hex" page. So, I assume you've got a hex.mipage file. We recommend that you name the "root" file of your MiSite as index.mipage.

Then, from a clear workspace
      ]load /git/DUI/DUI
⍝ run with HRServer (assumes you've renamed hex.mipage to index.mipage)
DUI.Run '/MiSites/site1' ⍝

or
      ⍝ run the hex.mipage directly with HRServer if you've not renamed hex.mipage to index.mipage
DUI.Run '/MiSites/site1/hex'

or
      DUI.Run '/MiSites/site1' 8080  ⍝ this will run it with MiServer on port 8080

and this will allow you access your MiSite via the browser of your choice and you can go to http://127.0.0.1:8080/hex to run the hex page, or if you rename hex.mipage to index.mipage you would go to http://127.0.0.1:8080.

I hope this helps!
/Brian
User avatar
Brian|Dyalog
 
Posts: 112
Joined: Thu Nov 26, 2009 4:02 pm
Location: West Henrietta, NY

Re: Converting from MiServer 3.1 to HTMLRenderer

Postby ray on Sat Sep 04, 2021 6:36 pm

Thank you so much Brian, I now see I was really barking up the wrong tree!

I think I now understand that the HTMLRenderer offers an alternative to using an external browser (such as Chrome) with the Chromium Embedded Framework which is now built into to Dyalog.

I will now spend some time absorbing and getting my head around the contents of your reply in detail.


Thanks once again for all your help, and advice, and hard work that you have put into MiServer.
Ray Cannon
Please excuse any smelling pisstakes.
User avatar
ray
 
Posts: 192
Joined: Wed Feb 24, 2010 12:24 am
Location: Blackwater, Camberley. UK


Return to MiServer

Who is online

Users browsing this forum: No registered users and 1 guest