![]() %% ejabberd functions for JID manipulation called jlib. %% included for writing to ejabberd log file %% The gen_mod behavior requires two functions: start/2 and stop/1 %% Every ejabberd module implements the gen_mod behavior Fill in the file you created “mod_http_offline.erl” with the following code: This should give us a good idea of how ejabberd handles modules. Lets start with a very simple module that just does logging. Finally, time to start coding!Ĭreate a file named mod_http_offline.erl. Lets start with a very simple module that does nothing but logs out information. The next step is to get a basic module installed and make sure it is working. The officially recommended IDE is Erlang mode for Emacs. ![]() Also, there are several choices of plugins for NetBeans or Eclipse. I recommend Sublime Text 2 with Erlang syntax highlighting turned on. This is important so you are using the same Now that you have the ejabberd version go to ejabberd official site and see which version of erlang was used. If you are getting the error mentioned, copy your erlang cookie from the windows folder This needs to match the one in your user folder. On my box ejabberd runs using theĮrlang cookie from “C:\Windows\.okie”. If you get the same error when trying to start you might have a “.okie” mismatch. If you you get an error like the following “Failed RPC connection to the node : nodedown” Note on ejabberd start error and erlang cookie You should see something like this “The node is started with status: started Go to start, run, and type cmd to open a command prompt. If you don’t know your ejabberd version here is how to get it. What version of Erlang was used with your installed ejabberd? You can find that information here using your ejabberd version number (if you don’t know the version number skip ahead to the next section before following this link). The Erlang version is important because it should match the one used in the installed ejabberd server. You need Erlang to compile the new module. Let’s start with getting the Erlang environment up and running. Well, at least you will write some Erlang by the end of the post. Easy right?ĭon’t worry, it will all come together by the end of this post. Step one, take a deep breath and get up to speed on XMPP, ejabberd, and Erlang. If you don’t have ejabberd setup yet see my previous post on getting strophejs, ejabberd, and IIS all working together. Also, it’s the 24th most popular language on GitHub as of writting this so it can’t be that bad. Erlang is a functional programming language which is known for concurrency and high reliability. Why use ejabberd which is written in a wacky language called Erlang? Well… you will have to decide for yourself. My day job is programming in C# so this is going to be from a Windows. The main reason I’m experimenting with XMPP is to provide apple push notifications once a user closes an iPhone application. I should mention this is not production ready I’ve only just started working with Erlang and the XMPP server ejabberd. The following is how I created a custom ejabberd module to POST offline messages to a web application.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |