Ejabberd isolate group of users - erlang

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.

Related

Any material about ejabberd internal Erlang API?

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.

Is combining Parse.com API with Pubnub a viable option for large scale Real-Time Messaging and obtaining the combined toolset?

Essentially combining Parse with Pubnub, Pusher or similar, Instead of building a custom backend from scratch.
I'll be working on a real-time messaging system with facebook login and file storage/sharing. In theory I could use a combination of Parse and something like Pubnub to cover backend requirements. Were:
Parse takes care of:
Login
File Storage
Push-notifications(closed app)
And Pubnub takes care of:
real
time delivery of messages...
Requirements:
I need a system that can extend to millions of users if needed and can be deployed quickly
In general a solution that will fit this criteria and specs.
Criteria:
Quick deployment by one or 2 developers.
Can expand to millions of users.
High reliability
Specs:
FB Login
Realtime Msg delivery
Push for closed app delivery
Shared file & image storage
Any feedback if this as a first stage deployment would work well and any pitfalls would be greatly appreciated.
I'm a little biased but check out StackMob (www.stackmob.com), with the StackMob Marketplace you get direct access to PubNub with no need to create a second account. There are also a lot of other great services in the marketplace to add functionality such as SendGrid.
All the features you are looking for are out of the box even the separate development and production accounts. Something you don't get with Parse. With a simple click of a button you can move Schemas and custom code from development to production.
We can certainly support the users you are talking about. We have 7 games from Atari on the platform and other big enterprise like Land O Lakes and Adidas Japan. We also have a great track record when it comes to reliability.
Sounds good, but 2 systems (Parse and PubNub) contradict your criteria Quick deployment by one or 2 developers.
There is reason to find one system which satisfies all your requirements.
You could loot at QuickBlox backend - your own cloud backend
It has 7 modules(sets of API) for different tasks. You may be interested in:
Users module - it has Facebook/Twitter login
Messages module - this is Push Notifications. It supports iOS, Android, BlackBerry, WindowsPhone push notifications
Content/CMS module - it allows to store/share/stream any type of files, any size (up to 5 TB!)
Chat module - realtime message delivery. QuickBlox Chat is a quick and reliable chat solution which combines benefits of scalable cloud hosted XMPP chat server, seamless Single Sign-On authorization via Users module, incoming IM / chat alerts via Push Notifications and file attachments via Content.
I recommend look at it, it also have lots of great features such custom API creation via Custom Objects module
Also, there is Enterprise solutions - QuickBlox this is white box, so you can deploy it to your own server and re-sale to other clients if you want
The short answer:
no.
The details:
Anyway you hash it, it's too expensive to setup a chat with any of these systems since their BaaS model is based on charging on a per number of calls basis.
I had to work out a lot of the logic my self using parse.com and now that I'm implementing an XMPP solution, the quantity of work is the same to get something working.
My alternative solution:
Use an open source xmpp server like ejabberd on something like AWS and then use one of the APIs to connect to it.
Contact me of you need more info on my experiences:
#andrescanella

Need a multi user voice chat application that can be integrated into rails application

Is there is any rails plugin that can be used for voice chat between multiple users?
OR
multi user voice chat application in any other language that can be integrated with rails application?
Eagerly waiting for help.
Well, there's always the possibility to use any of the available FOSS VoIP solutions. I'm not aware of any that have Ruby plugin capabilities out-of-the-box, but you could always write the plugin yourself. Most of them are very well documented, and reference implementations exist for a number of languages.

How to provide your app with a network API

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

Mass emailing users of a rails app

I have a rails app that just launched and I have over a thousand users signed up to the site. We are interested in keeping in contact with the community through email newsletters. We have been using a third party tool and migrating the email addresses from one database to another. Is there an easier way to do this from rails? I am open to suggestions.
http://github.com/adzap/ar_mailer
ar_mailer will allow you to queue up mail and send it out over time so you don't violate any mail rules put in place by your host.
If you really, absolutely, definitely need to send to these emails yourself, and you're dealing with a larger user base, you'd probably want to go through a distributed setup employing something like Starling, RabbitMQ, or the all-new Resque to distribute the task of sending these emails across a multitude of workers.
It's a topic far from trivial, so all in all I'd recommend using an external service provider for this.
Use ActionMailer to generate emails from templates (views) using Erb. I would do this unless you wish track clickthroughs back to your site from those mails, then you may be better of using a third party.
As an aside (I'm sure you know this but), be aware that you'll need to inform your ISP and demonstrate to them that you have permission from your users to send these emails, else they may block you from sending without warning.
You can simply loop through all the emails and send individual emails. It's pretty simple using rails and there are tutorials everywhere.
You could also use the third party API to add automatically your users emails to their database. If you could provide the third party you're using, I could maybe give you more information.
Some newsletter website give you the option to add emails directly in their system via a given form. Why not use this form? You would put it somewhere on the website and the system will add the new emails to the third party software and not to yours. Of course this only works if you have a "enter your email here to subscribe" kind of logic.

Resources