node.jserlangcross-language

How to estabilish communication between an erlang application & a nodejs server?


I have an erlang app with API and i need to call these API functions from a nodejs server and process the response. For example: Nodejs sends data to app, app processes the data then sends it back to nodejs and finally nodejs processes the result.

So far my best idea was launching the app in a cmd as a child process but that is really hard to work with and when i looked up, all i found was people suggesting not to use nodejs but that is unfortunately not an option for me.

EDIT: For clarification my question is what is the best way to call the erlang functions from nodejs


Solution

  • My suggestion is to implement Erlang application API as a RESTfull API using one of Erlang open source web servers Cowboy, Mochiweb, Webmachine. In this case you can invoke Erlang API from NodeJs using HTTP client (you can find a lot of implementation of HTTP client for Javascript and NodeJS especially). This way is easy for implementation and maintenance.

    There is no easy way to invoke remotely Erlang functions from JavaScript. Erlang has ability to communicate with C/C++ (Erlang Port) and Java (JInterface) application only.