zeromq / exzmq Goto Github PK
View Code? Open in Web Editor NEWZeroMQ for Elixir
License: Mozilla Public License 2.0
ZeroMQ for Elixir
License: Mozilla Public License 2.0
I tried, but I couldn't. There's a lot to fix.
Hey there,
this might potentially be a noob question, but I've got trouble getting the simplest 'Hello World' example two work.
I've started to read the ZMQ book and wanted to port the examples over to elixir. The code I'm talking about is located here https://github.com/BjRo/zguide/commit/fdcf59738cfa86afd674ff72ee890893a41cf01a
The server seems to start correctly. However when I try to connect a client from a different shell I get this:
* Generic server <0.60.0> terminating
** Last message in was {connect,tcp,{127,0,0,1},5555,[]}
** When Server state == {'Elixir.Exzmq.Socket',<0.2.0>,
{'Elixir.Exzmq.Socket.Fsm.FsmState',
'Elixir.Exzmq.Socket.Req',idle,
{'Elixir.Exzmq.Socket.Req.State',none}},
<<>>,passive,[],none,[],none,[],[],[],[]}
** Reason for termination ==
** {noproc,{gen_server,call,
['Elixir.Exzmq.Link.Sup',{start_child,[]},infinity]}}
** exit {{:noproc, {:gen_server, :call, [Exzmq.Link.Sup, {:start_child, []}, :infinity]}}, {:gen_server, :call, [#PID<0.60.0>, {:connect, :tcp, {127, 0, 0, 1}, 5555, []}]}}
(stdlib) gen_server.erl:180: :gen_server.call/2
(zmq) lib/hwclient.ex:5: Zmq.HWclient.run/0
(stdlib) erl_eval.erl:655: :erl_eval.do_apply/6
(elixir) src/elixir.erl:140: :elixir.eval_forms/4
(elixir) lib/code.ex:130: Code.do_eval_string/3
(elixir) lib/enum.ex:517: Enum."-each/2-lists^foreach/1-0-"/2
(elixir) lib/enum.ex:517: Enum.each/2
(mix) lib/mix/tasks/run.ex:53: Mix.Tasks.Run.run/1
It looks like a missed pattern match in connect
. Is there something obvious I'm doing wrong? Is it the way I start things via mix run -e "Zmq.HWclient.run"
?
like this:
=PROGRESS REPORT==== 5-May-2014::11:13:51 ===
supervisor: {local,ranch_sup}
started: [{pid,<0.119.0>},
{name,{ranch_listener_sup,my_http_listener}},
{mfargs,
{ranch_listener_sup,start_link,
[my_http_listener,100,ranch_tcp,
[{port,19000}],
cowboy_protocol,
[{env,
[{dispatch,
[{'_',[],
[{[],[],'Elixir.WebSocketHandler',
[]}]}]}]}]]}},
{restart_type,permanent},
{shutdown,5000},
{child_type,supervisor}]
=PROGRESS REPORT==== 5-May-2014::11:13:51 ===
application: bigdata_ws
started_at: nonode@nohost
Should remove SASL?
I get the error message:
Erlang/OTP 17 [erts-6.1] [source-d2a4c20] [64-bit] [smp:8:8] [async-threads:10] [hipe] [kernel-poll:false]
==> gen_listener_tcp (compile)
Compiled src/gen_listener_tcp.erl
== Compilation error on file lib/exzmq/socket/dealer.ex ==
** (CompileError) lib/exzmq/socket/dealer.ex:6: undefined function defrecord/2
(stdlib) lists.erl:1352: :lists.mapfoldl/3
(elixir) src/elixir_exp.erl:49: :elixir_exp.expand/2
(elixir) src/elixir.erl:206: :elixir.quoted_to_erl/3
(stdlib) erl_eval.erl:657: :erl_eval.do_apply/6
(elixir) src/elixir.erl:175: :elixir.erl_eval/3
When compiling against Elixir 0.13 you get the following compilation error
== Compilation error on file lib/exzmq/link.ex ==
could not compile dependency exzmq, mix compile failed. You can recompile this dependency with `mix deps.compile exzmq` or update it with `mix deps.update exzmq`
** (CompileError) deps/exzmq/lib/exzmq/link.ex:5: module GenFSM.Behaviour is not loaded and could not be found
(elixir) /Users/bjornrochel/Coding/Laboratory/zguide/examples/Elixir/zmq/deps/exzmq/lib/exzmq/link.ex:5: Kernel.use/1
/Users/bjornrochel/Coding/Laboratory/zguide/examples/Elixir/zmq/deps/exzmq/lib/exzmq/link.ex:5: Exzmq.Link (module)
The Elixir maintainers apparently weren't happy with the GenFSM wrapper and removed it :-/
Just installed elixir the first time and wanted to get right into using it with exzmq. Noticed that the tests fail
elixir -v
Elixir 1.1.1
mix test
......
1) test open a rep socket and wait time out (ExzmqTest)
test/exzmp_test.exs:117
** (MatchError) no match of right hand side value: {:error, {{:badmatch, {:error, :eaddrinuse}}, [{:gen_listener_tcp, :init, 1, [file: 'src/gen_listener_tcp.erl', line: 101]}, {:gen_server, :init_it, 6, [file: 'gen_server.erl', line: 328]}, {:proc_lib, :init_p_do_apply, 3, [file: 'proc_lib.erl', line: 240]}]}}
stacktrace:
test/exzmp_test.exs:119
...
It's unclear whether this is an outdated version of zeromq binding (3.1) or an up-to-date ZMTP implementation.
defstruct socket: nil,
address: nil,
acceptor: nil,
type: nil, # :client or :server
clients: [], # list of client connections, if socket is of type server
state: :greeting,
messages: :queue.new()
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.