Giter VIP home page Giter VIP logo

zmq_ex's People

Contributors

dreat avatar fabiankrol avatar nenros avatar olo2552 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

Forkers

dreat nenros

zmq_ex's Issues

Implement proper handshake

Elixir client should be able to connect to python server
Elixir server should allow connection from python client

Don't loop inside `GenServer` callbacks

https://github.com/half-t/zmq_ex/blob/master/lib/zmq_ex.ex#L42

GenServer is a loop. If you recursively loop inside handle_*, it can't process new messages ever.
E.g. The initiation in handle_info should return state with socket and let GenServer accept new messages.
Later send_loop can be replaced by handle_cast like this.

# API function
send_message(pid, msg) when is_binary(msg) do
  GenServer.cast(pid, {:send_msg, msg})
end

handle_cast({:send_msg, msg}, %{socket: socket}) do
  enc_reply = encode(reply)
  :gen_tcp.send(socket, enc_reply)
  {:no_reply, state}
end

In general, never put loops inside handle_*. Even when playing around :D

Fill in README

Hey guys! I want to participate a little bit, but I am not sure what is the end goal.
Could you explain what the project goal is?
How is it going to be different from existing work https://hex.pm/packages?_utf8=%E2%9C%93&search=zeromq&sort=recent_downloads

Is the project goal to learn or to make something production ready?

In case you'd like to make it production ready, I suggest using connection library for permanent connections https://hex.pm/packages/connection
And ranch as TCP acceptor pool https://hex.pm/packages/ranch
It would make both currently open PRs unnecessary.
(I am not that familiar with ZeroMQ so please check if that makes sense)

Cleanup compiler warnings

Compiling 1 file (.ex)
warning: variable "send?" is unused
  lib/zmq_ex.ex:22

warning: variable "send?" is unused
  lib/zmq_ex.ex:35

warning: function connect/2 is unused
  lib/zmq_ex.ex:41

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.