We have a gen_server that, right now, is only called from other Erlang applications. However now we have a client that wants to use the software but their code is written in Javascript using node.js. I’d prefer not to go through the overhead of building a web interface to our system. If we have to perhaps we’d make a websocket service but my preference would be to simply write them a Javascript client library that can talk directly to our system as if it were just another process similar to how Pyrlang works for Python/Erlang.
Is there a Javascript library out there that supports this? Has anyone had success doing this kind of intergration with a node.js app? Appreciate recommendations and experience stories.
calling C++ and python each other via Corba with mutual memory management
Result is simple: never again =) Calling HTTP or sending JSON-nd via stdout is something that really works when you need to connect two people. If you do something non-trivial, you will have lot of pain when you have to focus on something new and live your interesting configuration to other people for support.
HTTP infrastructure costs almost nothing and is a basic standard nowadays.
This is for a high-performance low-latency asynchronous event store so avoidance of overhead like http infrastructure has significant impact on the ultimate performance of the system. It’s cost isn’t nothing at our scale. HTTP isn’t very good at asynchronous calls which is what everyone of these is. Otherwise, completely agree that it’s a PITA. But this is one of those exceptions where it is worth it.
So you want to have some “scripting” considering that javascript is easier than erlang?
Can you share, what kind of logic can be written in another language, while maintaining such throughput and latency that http doesn’t fit?
This is a well known situation for me, our streaming server is designed for throughputs more than 1 million delivered frames per second, so there are nifs, etc, but it is interesting, what situation do you have.
Tried node-erlang-bindings, but so far have only been able to establish connection with the Erlang node. const mynode = new ErlangNode("node2", "persistence", "node1@127.0.0.1");
But, going by the examples in “test-napi.js”, haven’t yet be able to make gen_server calls or RPC calls successfully… let res = mynode.ex.GenServer.call(serverName, request);
Making the call the same way as shown in the only example results in this error: TypeError: badrpc(undef): Erlang function Elixir.GenServer.call not found
I suppose that could be because I’m working with an Erlang node, and not Elixir, but I haven’t found a proper way to make a similar gen_server call to Erlang with this library.
Similarly, I’ve tried calling one of the exported functions in our app using an RPC call: res = mynode.rpc(atom("db_lib"), atom("list_databases"), [tuple("Admin123", "adm123")]);
“list_databases” is an exported function in our “db_lib” module, but the call results in this error: TypeError: badrpc(function_clause): Erlang function db_lib.list_databases not found
Most of the examples in node-erlang-bindings seem to be Elixir-specific, so would be grateful for any pointers on making these calls to Erlang, if anyone has experience with this library!
At this point, I’m considering the option of implementing a websocket handler with Cowboy to communicate with JS.