[erlang-questions] Erlang node in golang

Taras Halturin halturin@REDACTED
Wed Sep 27 15:37:02 CEST 2017


Hi *,

I've just finished to develop erlang node implementation on golang. Its
based on some parts of https://github.com/goerlang, but totally reworked.
Now you can create your own nodes using golang and send sync/async messages

here is some example...

Node := ergonode.Create("examplenode@REDACTED", 21234,
"SecretCookie")completeChan := make(chan bool)gs := new(goGenServ)

n.Spawn(gs, completeChan)
message := etf.Term(etf.Atom("hello"))
// gen_server:call({pname, 'node@REDACTED'} , hello)to :=
etf.Tuple{etf.Atom("pname"), etf.Atom("node@REDACTED")}
answer, err := gs.Call(to, message)
fmt.Printf("Got response: %v\n", answer)
// it's also possible to call using Pid (etf.Pid)answer, err :=
gs.Call(Pid, message)
// gen_server:cast({pname, 'node@REDACTED'} , hello)to :=
etf.Tuple{etf.Atom("pname"), etf.Atom("node@REDACTED")}
gs.Cast(to, message)
// the same way using Pid
gs.Cast(Pid, message)
// simple sending message 'Pid ! hello'
gs.Send(Pid, message)
// to get pid like it does erlang:self()
gs.Self()


Grab it here: https://github.com/halturin/ergonode

Any feedback is highly appreciated


-- 
Best Regards.
Taras Halturin
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20170927/456159e9/attachment.htm>


More information about the erlang-questions mailing list