esl / MongooseIM

MongooseIM is Erlang Solutions' robust, scalable and efficient XMPP server, aimed at large installations. Specifically designed for enterprise purposes, it is fault-tolerant and can utilise the resources of multiple clustered machines.
Other
1.66k stars 427 forks source link

Add support for elixir #373

Closed fire closed 9 years ago

fire commented 9 years ago

After reading ejabberd-joins-the-elixir-revolution, I wonder if MongooseIM will have the support.

Not sure what the current status of this is.

scrogson commented 9 years ago

@fire I'm working in the other direction (adding Mongoose as a dependency in my Elixir application). I think that is a better approach in my opinion. Calling Elixir modules in Erlang is not quite as nice as calling Erlang from Elixir.

creese commented 9 years ago

@scrogson I want to do this too. What is your approach?

scrogson commented 9 years ago

@creese at the moment it's kind of a hack (there are many rebar dependency overrides required):

The phoenix-integration branch contains an update on the cowboy dependency to 1.0 which is required to integrate with Phoenix.

Here's a snippet from mix.exs:

  def application do
    [mod: {MyApp, []},
     applications: [
       :logger, :phoenix, :cowboy, :ejabberd, :hedwig
     ]]  
  end

  defp deps do
    [{:phoenix, "~> 0.10"},
     {:hedwig, "~> 0.1"},
     {:exml, github: "esl/exml", override: true},
     {:mongooseim, github: "esl/MongooseIM", branch: "phoenix-integration"},

     #overrides
     {:cowboy, "~> 1.0", override: true},
     {:edown, github: "uwiger/edown", tag: "0.5", override: true},
     {:lager, github: "basho/lager", ref: "2.0.3", override: true},
     {:proper, github: "manopapad/proper", tag: "v1.1", override: true},
     {:p1_utils, github: "processone/p1_utils", ref: "9e646e4", override: true},
     {:meck, github: "eproxus/meck", tag: "0.8.2", override: true},
     {:folsom, github: "boundary/folsom", ref: "4824aec", override: true}]
  end 

Once you do that, you'll need an etc/ejabberd.cfg in the root of your project.

I'm using my XMPP client/bot framework Hedwig along with Phoenix Channels to wire everything together.

One of these days I'll create an example repo. For now, here is the talk that @michalslaski and I gave at Erlang Factory SF last week: https://www.youtube.com/watch?v=1TpK4NDEEVA

Here are the slides: https://speakerdeck.com/scrogson/mongooseim-plus-phoenix

Hope that helps!

mossplix commented 9 years ago

Thanks ... wanted to @scrogson . Wanted to use exmpp and was disappointed that it has not been updated in a while. linking mangooseim is by far a perfect solution.

COLABORATI commented 9 years ago

Interesting talk! Can we have some examples on how to access mongoose functionality from phoenix? In the talk you mentioned building a login screen / user registration - that would be a perfect example! And is there any documentation for mongooseim api and what can be used this way (and what not)? Unfortunately I see zero documentation on the els mongooseim site, where do I have to look (besides trying to understand the source)? Thanks!

scrogson commented 9 years ago

@COLABORATI here's an example repo I created using the latest ejabberd. It should be pretty much the same if using MongooseIM.

https://github.com/scrogson/jabba

fire commented 9 years ago

I hope that it would be possible to write elixir plugins for mongooseim. @michalwski

9to1url commented 4 years ago

Where is the branch phoenix-integration ? I can't find it now.

9to1url commented 4 years ago

I am reading this: https://github.com/kevinblade/phoenix-mim I like to have access like that: iex> :ejabberd_auth.try_register("username", "localhost", "password")

Even can run MIM in standalone mode, but would like to using: iex> :ejabberd_auth.try_register("username", "localhost", "password")

Please help on this.