Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/zgbjgg/clicktochat_ejabberd

Click To Chat implemented on Ejabberd
https://github.com/zgbjgg/clicktochat_ejabberd

click-to-chat ejabberd erlang instant-messaging

Last synced: about 12 hours ago
JSON representation

Click To Chat implemented on Ejabberd

Awesome Lists containing this project

README

        

clicktochat_ejabberd
====================

Click To Chat implemented on Ejabberd

Before To Start
====

You must install Ejabberd and stop it!!

How To Start
====

Clone the project from github:

$ git clone https://github.com/jorgegarrido/clicktochat_ejabberd.git

Move into project directory:

$ cd clicktochat_ejabberd

Configure the file 'clicktochat.conf' correclty (each section in the file is described on it)

Let's compile and install:

$ make && sudo make install

Enable Click To Chat
====

In the config file /etc/ejabberd/ejabberd.cfg configure the sections:

modules, add mod_clicktochat:

{modules,
[...
...
...
{mod_clicktochat, []}
]}.

and in the section ejabberd_http, add a new handler mod_http_clicktochat

{5280, ejabberd_http, [...
...
http_poll,
%%register,
web_admin,
{request_handlers,
[ {["clicktochat"], mod_http_clicktochat}]}
]}.

Registering client users
====

NOTE: At this step you must have created helpdesk users and they can be connected to ejabberd!

Let's create a single user, using http interface:

$ curl -i -H "Accept: text/xml" -X POST -d "my_client123" http://IP:PORT/clicktochat/register

The response will be an xml containing the client's nick and the
helpdesk user that is automatically linked to start the chat, from your
application you must send messages to this nick (helpdesk user).

Listing all users connected
====

Using http interface:

curl -i -X GET http://IP:PORT/clicktochat/list

The response will be an xml containing all helpdesk users connected, now from your
application you can choose one and start the chat.

Request - Response RESTful Services Description
====

--------------------------------------------------------------------------------------------------------------------------------------
| URI | Method | Request Body | Response | HTTP Status Codes |
--------------------------------------------------------------------------------------------------------------------------------------
| | | | | |
| /clicktochat/register | POST | | | |
| | | username | ok | 201 (Created) |
| | | pass | user_from@domain | 400 (Bad Request) |
| | | | user_to@domain | |
| | | | | |
--------------------------------------------------------------------------------------------------------------------------------------
| | | | | |
| /clicktochat/list | GET | empty | | 200 (Ok) |
| | | | username | 400 (Bad Request) |
| | | | | |
--------------------------------------------------------------------------------------------------------------------------------------

Round Robin Queue
====

This project implements the round robin in the queue, when a client user is registered
and connected, then in the queue, a helpdesk user is get and placed to the end
of the queue, ensuring that the client users are equally asigned to the helpdesk users,
avoiding that a single user attends all requests.

queue then in the queue, get a user and pass to the end
-------------- --------------
| USER-1 | | USER-2 |
|------------| |------------|
| USER-2 | ======> a new client is registered ======> | USER-3 | =======> now CLIENT-1 can start
|------------| (CLIENT-1) |------------| a chat with USER-1
| USER-3 | | USER-1 |
-------------- --------------

Integrating with DB
====

To save the conversation in any database that you choose, you can perform the
actions on module 'hooksI', in the function 'on_user_send_packet', in the case
where Packet is evaluated you can perform actions on it.