It’s a collection of libraries and design principles that are written in Erlang language which helps to run a high run-time application with high scalability. It's a concept of “Write once and Run forever”. Here comes a list of technical procedures parameters you will be following to develop one-to-one chat application.Įrlang is an open source functional programming language used in generating high scalability and requirement of system availability. So, we would be handling with such technologies Erlang (Language), Ejabberd (Framework), XMPP Protocol, MySQL (Database). The technologies are the key factors used for WhatsApp success. Well! In this article, I will walk through the end-to-end development of a chat application from scratch. To create some exposure within the enterprises and business professionals who wish to create a chat application using some of the high-grade technologies, here comes the enlightenment. ![]() Thus, its essence in industrial and versatile communication is significant. Now start up the server and you should have offline messages posting to your web application.Chat apps have been revolutionizing the apps market. Copy the beam file overitting the old version. Type = xml:get_tag_attr_s("type", Packet),įromS = xml:get_tag_attr_s("from", Packet),īody = xml:get_path_s(Packet,, ), ?INFO_MSG("stopping mod_http_offline", ),Įjabberd_hooks:delete(offline_message_hook, _Host, ?MODULE, create_message, 50). ?INFO_MSG("mod_http_offline loading", ),Įjabberd_hooks:add(offline_message_hook, _Host, ?MODULE, create_message, 50). Post_offline_message("testFrom", "testTo", "testBody"), %% 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 |