I have to create a chat app for my company, and, since I do programming in Elixir, my choice is ejabberd with Erlang/Elixir. I managed to install ejabberd as a dependency into my Elixir project, configured it, and I am also able to connect to it with some XMPP clients from the outside.
What I still need to achieve is to create a web based interface for the users where they can see the messages of certain conversations and where they also can push in text messages into ejabberd. Phoenix with it's channels are a perfect tool for this.
The missing parts I'm trying to figure out are some direct function calls into the ejabberd internals. Namely the followings are missing:
how can I do my own authentication in ejabberd with my already existing user base? (Erlang or Elixir)
how do I set the presence of a user with internal ejabberd function calls, when one uses it from Phoenix?
how can I tap into the message flow that goes trough ejabberd in order to broadcast those messages using Phoenix channels?
how can I send ejabberd messages from Erlang or Elixir in the name of a user?
I'm afraid ejabberd is poorly documented and it's mostly the source code that cen help me out. But I hope I'm wrong and there are some tutorials, blog posts, videos about the internals of it.
I would really appreciate any links to howtos, blog posts, example repos related to the internal Erlang API of ejabberd.
Here are what I already have, but this just scratches the surface:
elixir-sips-ejabberd-with-elixir-part-1
ejabberd-joins-the-elixir-revolution
the best source I ever found that explains how ejabberd works and what to do to plugin into its architecture is here:
http://anders.conbere.org (look at the links close to the bottom of the page)
Part1: http://anders.conbere.org/2008/07/16/building_ejabberd_modules_-_part_1_-_compiling_erlang.html
Part2: http://anders.conbere.org/2008/07/17/building_ejabberd_modules_-_part_2_-_generic_modules.html
Part3: http://anders.conbere.org/2008/07/31/building_ejabberd_modules_-_part_3_-_http_modules.html
Part4: http://anders.conbere.org/2008/08/06/building_ejabberd_modules_-_part_4_-_xmpp_bots.html
There is the developers guide in the official documentation: https://docs.ejabberd.im/developer/guide/
But full API is not documented, no.
Related
I want to isolate some users of Ejabberd. I mean that only specific users within a list (in database, json, or any other format) can interact (chat, subscribe, etc). Is this possible by developing a plugin or I need to hack Ejabbed code?
It is possible by developing a plugin. You can for example, use the filter_packet hook in ejabberd.
You can find the list of hooks on ejabberd documentation site for developers.
I am new to Pubnub and real-time application. I wrote some ruby application before and I am currently research an option to integrate pubnub into my rails application. I read pubnub docs already and have an basic architecture in my head but not quite sure if it is good or even feasible. I appreciate any opinions.
In the application, there will be a peer to peer chat window, and one person can talk to any person he wants.
1) Rails will not store any messages, and it will only stores which channels each person is subscribing to. In this case, since it is a peer-to-peer chat, a channel person publishing to is also the channel the person subscribing to. Rails will store all channels informations for all channels. And thats' it.
2) In client side, server will give each current_user the channels him/her subscribing/publishing to and using those channels, current_user can retrieve all history chats from pubnub server for channels he/she subscribes to.
This is what's in my head. Is there a better architecture implementation ? As far as I read in pubnub docs, they don't store channels for each unique user. Also, in terms of security, since everything will happen in the front-end and subscribe/publish key will be exposed to the browser. How secure is it ? Any drawbacks to this implementation ?
Thanks !!
Its very feasible... you can even get more creative after you nail down the basics. Here is a good chat with PubNub overview link:
http://www.pubnub.com/use-cases/chat/
Here you will find links to iOS and JS demo chat implementations.
Just for our Ruby fanatics, here is the link to a chat app purely using our Ruby SDK:
https://github.com/pubnub/ruby/blob/master/examples/translator.rb
The ruby app is pretty cool, as it lets people not only chat, but chat across multiple languages (via Bing translation API).
I'd say cut your teeth on these, and if you need further guidance, just shoot an email to support#pubnub.com, and we'll get you up and running with more tools and tricks specific to your use case.
I'm using Spring.NET Twitter extensions in an application. Instead of querying in a loop for twit updates (pulling), I just want to listen to twits of interest (hashtags, # mentions, keywords or updates in timeline) and receive push notifications as they come. So I think the way to do it is to use an event model such as Observables, however, I can't find anything in the API to handle this nor any samples to demonstrate it. I would appreciate if anyone can put me in the right direction for this functionality. Thanks.
Spring Social Twitter only recently started supporting Twitter's streaming API. But that's for Java and your question is about SpringSocial.NET. I doubt that SpringSocial.NET has support for this yet. But I'll ping Bruno (the SpringSocial.NET project lead) and see if he can chime in here.
Until SpringSocial.NET supports Twitter's streaming API, your options are to continue polling (which is non-ideal due to rate limiting concerns) or to implement streaming support on your own. I'm sure Bruno wouldn't mind a pull-request to add streaming support to his project. :)
To be clear, SpringSocial.NET is not the same project as Spring Social and the two projects are only loosely related (in that I know who to email if there's ever a question about SpringSocial.NET).
Rx will just allow you to expose Push based API nicely. If the API does not support Push then you could use Rx to Fake Push by doing polling but expose it as if it was push (Observable.Interval or Schedulers etc).
You first will need to find how Twitter exposes Push based notifcations. If your Client (Spring.NET Twitter Ext) does not support this you are stuck with polling (via Rx or not).
It appears that you want to look at Twitter Streams API (https://dev.twitter.com/docs/streaming-apis)
Can someone explain to me what to consider first when designing a meta-search engine using Erlang, Mnesia and the Yaws web server? This engine should have SMS capability but I am still wondering how I am going to incorporate this feature...
The meta search engine, you need REST or Ajax APIs from Google, Yahoo and Bing. Below am providing you with examples which you may use within your back end HTTP capable Library or your front end JavaScript. I personally use mochiweb and yaws Appmods.
For example: Google has an Ajax search API which works like this:
http://ajax.googleapis.com/ajax/services/search/web?v=1.0&q=computers
Hitting that URL will give you a JSON Object which contains several search responses. In this case, the search term is "computers"
Yahoo has what it calls Boss APIs. An example of Yahoo Rest search API using Boss is here below:
For an XML result:
http://boss.yahooapis.com/ysearch/web/v1/animals?appid=APPID&format=xml&start=1&count=3
For a Json result:
http://boss.yahooapis.com/ysearch/web/v1/animals?appid=APPID&format=json&start=1&count=3
Analyse the whole HTTP GET query very well, you notice something they call an APPID. This you will get when you register with them here. I cannot give to you my APPID, you will have to get yours,then paste it in there and you will be good to go. Yahoo has something more powerful called
YQL. In the above query, the search term is: "animals"
Bing as well has got an API for you, but you will need an APPID:
http://api.bing.net/json.aspx?AppId=APPID&Query=love&Sources=Web&Version=2.0&Market=en-us&Web.Count=10
Above, the search term is: "love"
About the Meta Search Engine
You have a web page, people enter search queries in this page. You use your javaScript (JSONP). JSONP could be implemented in any one of your favorite JavaScript Framework you use e.g.
JQUERY,Ext JS,Dojo, Prototype e.t.c
Then you would have to parse the XML or JSON response from the three sources (Google, Yahoo and Bing),and make an appropriate display for your users to navigate the results.
About the SMS part
SMS capability is attained using SMS Gateway. There are several open and close source SMS Gateways. the most powerful of them all is the one built in Erlang/OTP technology called: OSERL, but to test it, you need direct connection with an SMSC in anyone of your local service provider.You need a Port on their SMSC, a user name and a password.There is another one which is better for development reasons called: NowSMS because it has capabilities for USSD, Modem Internet Communication, SMSC service connectivity, HTTP 1.1 and HTTP 1.0, configuration of two-way SMS messaging e.t.c from a Web App to-and -from the SMS Gateway. Go to their site, grab the trial version, follow the documentation and then configure two-way from your web app to the gateway and vice versa. Since NowSMS is not free, you can try: Kannel, it is open source but you will need help from the community to set it up on your Unix or Linux box.
More on incorporating SMS capability in Web Applications can be found:
Here
I also asked once a Question related to development of a powerful search engine using Erlang, Mnesia & YAWS webserver on Stackoverflow. I got plenty of good answers and responses.
Please CLICK ME!
Hope this may help. As I am not sure about SMS thing.
I am going to write a Ruby application that implements a video conversion workflow consisting of multiple audio and video encoding/processing steps.
The application interface has two core features:
queueing new videos
monitoring the progress for each video
The user can access these features using a website written in Ruby on Rails.
The challenge is this: I want make the workflow app a self-sufficient application, not dependent on the existence of the web view.
To enable this separation I think that adding a network API to the workflow application is a good solution because this allows the workflow app to reside on a different server than the web server.
My question is: Which solution do you suggest for such a network API?
A few options are:
implement a simple TCP server and invent my own string based API
use some sort of REST api (I don't know if this is appropriate for this situation)
some sort of web-services solution (SOAP, XML-RPC)
another existing framework
Feel free to share your thoughts on this.
I would suggest two things:
First, use REST as your API. This allows you to write one core application with both a user interface and an API for outside applications to use.
Second, take a look at PandaStream. It's a Merb application that encodes videos from multiple formats into flash. It has a REST API, and there's even a Rails plugin so you can integrate it with your application. It might be a good example codebase, or even a replacement for the one you're trying to build.
Hope my answer helped,
Mike