![]() Hi, I’m following instructions and when I run. Please, join ejabberd mailing list or join the ejabberd chat room on XMPP are all eager to see what great ejabberd extension you are going to build with Elixir. In the meantime, all the ejabberd community is very glad to help get your started with ejabberd development using Elixir. You can expect follow up articles how how to get furtherĭeveloping ejabberd with the power of Elixir. We are in the process of revamping our developer documentation to help both Erlang and Elixir developer get up to speed on ejabberd module development. When you launch ejabberd with that new module, you should see the following line in the log file (or console if running live): 15:17:58.913 Starting ejabberd module Presence Demo testĪnd anytime an XMPP client changes its presence, you should see the following in the log file: 15:30:01.266 Receive presence for test Info('Stopping ejabberd module Presence Demo')Į(:set_presence_hook, host, _ENV_.module, :on_presence, 50)ĭef on_presence(user, _server, _resource, _packet) do ![]() Info('Starting ejabberd module Presence Demo')Į(:set_presence_hook, host, _ENV_.module, :on_presence, 50) Import Ejabberd.Logger # this allow using info, error, etc for :gen_mod Let’s expand a bit on this module: defmodule ModPresenceDemo do ejabberd canĭetect this is an Elixir module and use it appropriately. JustĪdd this line in the module section: modules:Īs you see, you can directly use the Elixir module name. You can now use it in ejabberd configuration file ejabberd.yml. When doing make install, it should install properly the newly created When you type make your module should build properly. This is the smallest possible ejabberd module. In ejabberd lib/ directory, add the file mod_presence_demo.ex: defmodule ModPresenceDemo :gen_mod You can now write plugins in Elixir and register hooks to expand ejabberd features in Elixir.Įjabberd lib directory is the place where you put your Elixir file so that the build chain knows how to compile them. Welcome to the revolution ! Writing ejabberd plugins in Elixir # Creating a :ejabberd_y_register("test2", "localhost", "mypass") sbin/ejabberdctl IO.puts "Hi ejabberd + elixir" It means you can use ejabberd shell using Elixir interactive commands: $ cd $HOME/my-ejabberd/ – iexdebug: Attach and Elixir console to an already running ejabberd – iexlive: Start ejabberd and keep an Elixir command open Object file: /Users/mremond/my-ejabberd/lib/ejabberd/ebin/Įjabberdctl module has now extra options: Module 'Elixir.Enum' compiled: Date: January 24 2015, Time: 16.27 Your ejabberd is now Elixir-enabled: $ cd $HOME/my-ejabberd/ configure -prefix=$HOME/my-ejabberd -enable-elixir Install Erlang R17 git clone and build ejabberd with Elixir support $ git clone cd ejabberd The change are available in ejabberd master branch and will be integrated in next ejabberd official version. Here is how to start using Elixir in ejabberd today. If you do not yet know Elixir, you now have the best reason of the world to learn it :) It is inspired by Ruby syntax, with all the benefit of Erlang VM, that is clustering, lightweight processes, robustness, fault tolerance, etc. ![]() ![]() For those who do not know about Elixir: This is a clean, modern programming language, created by Jose Valim, supported by hundreds of enthousiastic developers. In turn, we are hoping to do for Elixir, what ejabberd did for Erlang in terms of recognition. This change is probably the most important change in the life of ejabberd and we are already working with Elixir developer to improve on this existing implementation and boost our development community by making ejabberd development more accessible. You can now develop any module you want in ejabberd leveraging all ejabberd API using only Elixir language.įor those who already know about Elixir, I already hear the excitement that this new feature is generating. ![]() Today, we are getting further and are making Elixir language a first class citizen for ejabberd. So, YAML configuration files format was received as a relief by many users. YAML format is quite well know and avoided the typical mistakes make by users when editing “Erlang We already made the life of ejabberd users easier by providing YAML syntax for configuration files. Some people hate the syntax and cannot overcome their relunctance to learn it. “ejabberd is the main reason why I have learned Erlang”. When I talk to many of the developers that have learned Erlang in that past 10 years, they often thank us for ejabberd. This is what my Deps looks like in has always been a key project for Erlang. I tweaked it a little to match how they import other dependencies in Ejabberd, and it still didn't work. I found this tutorial, where they add Jiffy as a dependency for a different project, but it didn't work. I'm trying to add davisp/jiffy as a rebar dependency in Ejabberd so I can do some JSON parsing in my modules. ![]()
0 Comments
Leave a Reply. |
Details
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |