This blog will be updated regularly with technical articles which should give you a little bit of insight in what we do at Modelit. The articles will focus on Modelit's activities to integrate Matlab with Java to build better desktop applications with rich interfaces and functionality not provided by standard Matlab. And also on the possibilities to integrate Matlab with Javascript to make it possible to use Matlab in Web Applications, for example in combination with frameworks such as React, Dojo and Angular and to use Matlab as a service in environments such as Docker. We love to hear from you so don't hesitate to contact us with comments, questions or topics you'd like to see on this blog.
The Modelit Embedded HTTP server for Matlab can be used to call Matlab functions over the web. The result of this call will be for example a json or xml object with the result of the Matlab function. But what if we want to build a complete web app with a front-end in HTML and the back-end in Matlab. The front-end typically consists of one or more HTML, CSS and JavaScript files which have to be downloaded by the client's browser from the Matlab server.
In this article we will explain how you can use the Matlab Embedded HTTP server to serve files to a client, thereby making it possible to use it to deploy web apps.
The Modelit Embedded HTTP server for Matlab can be set up as an HTTPS server. This HTTPS server has the same functionality as the normal HTTP server. But has the advantage that it can be used to secure incoming and outgoing requests. This is useful when sensitive information is sent and received, or when the server needs to be protected with authentication.
To set up an HTTPS server, you’ll need an SSL certificate. You can use a free service, e.g. "Let’s Encrypt", or create a self-signed certificate using OpenSSL tool, or Java’s "keytool". In this article we will show how you can configure the Embedded Server with a self signed certificate generated by using the Java "keytool".
The Modelit Embedded Webserver Toolbox for Matlab makes it possible to use Matlab as an HTTP server. But it also contains methods to send HTTP requests, these methods are similar to the Matlab webread function. But the methods in the toolbox offer some extras.
One of these extras is to monitor the progress of a running HTTP request. In case a request takes a long time the user can be informed about the progress which will improve the overall user experience.
The Modelit Webserver Toolbox for Matlab makes it possible to use Matlab as an HTTP server. But it also contains methods to send HTTP requests. One of the advantages of using this toolbox is that Http requests can be sent asynchronously.
In this way the Matlab thread is not blocked and one can use fact that most servers can process multiple requests simultaneously. Modelit uses this for example in the MapViewer in which multiple map tiles are loaded simultaneously from an external server without blocking the Matlab application.