Article
· Apr 30 3m read

mg_web for ObjectScript Developers

A few weeks ago I posted an announcement about a JavaScript-based interface for our mg_web WebServer interfacing addon module.  mg_web isn't just restricted to use by JavaScript developers though.  Many readers will be ObjectScript developers who are more used to using CSP as their web gateway.  Some may even have much older legacy WebLink-based applications (and be wondering how to support them given that IRIS does not support WebLink).

This article aims to provide some more information on mg_web and to explain why it's worth a look for ObjectScript developers.

The first thing to understand is that mg_web has been deliberately designed as a completely generic and adaptable interface module for the "big three" web servers (NGINX, Apache and IIS).  mg_web supports both HTTP version 1.1 and 2.0 and WebSockets.  The idea is that the core mg_web add-on module communicates, using its own low-level protocol, with a compatible server.

The JavaScript version of mg_web works by mg_web communicating with one such server script written in JavaScript (known as mg_web_js).

However, another of mg_web's included server options creates a connection directly between the Web Server and one or more IRIS and/or Cache servers. When used with this server interface, you can develop your request handling code in ObjectScript, and you have access to Classes, SQL and all the other built-in ObjectScript functionality.  IRIS or Cache can be interfaced either via a network connection or an extremely high-performance in-process API connection, and you can optionally configure multiple servers for failover and/or load balancing.

By using different shims and configuration settings with the direct IRIS/Cache server mode, mg_web can be made to behave in pretty much any way you want.

For example, we've created a shim for use with the direct IRIS/Cache server connection that allows mg_web to emulate the behaviour of the original WebLink web gateway, therefore allowing legacy WebLink applications (including EWD applications) to be ported to IRIS.

Another interface we've created using mg_web is mgweb-server which is a simple framework that allows you to quickly and easily create ObjectScript-based REST API services that will run on both IRIS and Cache.   IRIS or Cache can be interfaced either via a network connection or an extremely high-performance in-process API connection, and you can configure multiple servers for failover and/or load balancing.

You can try mg_web working with mgweb_server out for yourself as we've included ready-to-run examples in our mg-showcase Docker Container for IRIS.

If you're interested in finding out more, we've summarised what we believe to be the benefits of mg_web for ObjectScript developers here, and you can read the relevant documentation in the mg-showcase and mg_web repositories.

The configurations and emulations we've provided for mg_web are just some examples we've created of what's possible.  We'd love to see what others can come up with!

Discussion (0)1
Log in or sign up to continue