necromorph23
Hello Everyone,
I am trying to create a Chat app like whatsapp and i have bascially read every other discussion on the forum regarding this topic and decided to use ejabberd (because i want to store messages when the reciever is offline , and security was also an issue.). I have also watched few implementations of Ejabberd in Phoenix Application.
Though i still have few doubts, i am already halfway through my application (its an application with many features chat is just a part of it) and i have my own Auth system in application which is working, my question is do i still need to use something like ejabberd.auth() and get JID from it to initiate my Chat stuff and from where can anyone give me some resources to understand the docs.
There is a lot of stuff and it’s quite overwhelming, also if anyone can give me some github link or anything if this stuff has already been implemented by someone else so that i can have a look.
Any help would be appreciated. Thanks for listening.
Trending in Questions
Other Trending Topics
Categories:
Sub Categories:
Forums
Popular Tags
- #ecto
- #liveview
- #troubleshooting
- #learning-elixir
- #library
- #deployment
- #erlang
- #testing
- #genserver
- #mix
- #absinthe
- #remote-other
- #otp
- #plug
- #how-to-question
- #macros
- #postgres
- #elixirconf
- #channels
- #exunit
- #discussion
- #code-sync
- #podcasts
- #javascript
- #onsite
- #dialyzer
- #docker
- #authentication
- #umbrella
- #full-time-contract
- #podcasts-by-brainlid
- #ecto-query
- #elixirconf-us
- #blog-post
- #ai
- #elixir-ls
- #phoenix_html
- #iex
- #graphql
- #genstage
- #websockets
- #supervisor
- #advent-of-code
- #distillery
- #processes
- #api
- #forms
- #hex
- #security
- #metaprogramming











Showing Posts 1 to 8- Show Best Posts
- Show All (oldest first)
- Show All (newest first)
derek-zhou
It seems like you have a lot to share; why not share whatever you have first?
necromorph23
Alright let’s start with the simple stuff
My application is what you could say is like Reddit + WA. I am almost done with the reddit part and decided to look into how am i going to implement the WA one.
Initially i thought i could just work with Websockets but they don’t provide all the services i needed. Like media transfers and how am i going to store messages for offline users and then deliver it.
Thats why i researched more and decided to go with Ejabberd.
The difficult stuff.
I have seen little bit of documentation and few implementation of Ejabberd in elixir but still not able to understand how am i going to implement one-to-one chat and multi user chat and also Video/Voice calls.
Researched a little bit more then i came to know about JID (Jabber ID) and then i realized (i might be wrong here) that Ejabberd basically calls functions like
ejabberdctl send_message chat 192.168.33.50 user1@192.168.33.50 “subject” “message from server”
and i guess here “user1@192.168.33.50” is acting like the JID.
The confusion part:-
I already have implemented basic Auth system with email and password but for chat functionality i think i need to generate somekind of JID as well i guess?
Even after i generate JID lets say how do i implement these one-to-one and multi user chat in my application because Ejabberd docs are some what confusing to me.
This basically sums up my problem.
Now few additional questions that i have if anyone can answer them
Q1) Should i use MNESIA or Postgresql as Database? (For my reddit part i am using PostgreSQL)
Q2) Do we generate JID again and again when user connects to the internet or it is generated only once when user first registers?
derek-zhou
You ask a lot of questions like “Should I …” These questions are generally unanswerable because we do not know your situation as good as you. If you can re-phrase your question into non-subjective and isolated question you can greatly increase your chance of getting help, and the helpers and on-lookers, etc can benefit from the discussion as well.
JeyHey
Q1: If you store the messages only until they are delivered and then delete them - giving the client the responsibility to store them (like WA does it) then I would say mnesia is good choice. If you want to store them on the server potentially indefinitely and make the client query them each time (like FB) then I would say Postgres is a better choice. But it is difficult to say and depends on a lot of factors.
Q2: A JID needs to be generated only once per user. But you don’t even need to as you can reuse your existing auth. All you need to do is to store it in a way Ejabberd can access it. Then, with a minimal amount of logic, you can make your client just construct the JID for authentication with Ejabberd und Ejabberd check the credentials. A JID has the following form: [username]@[serverdomain]/[resource]. Make Ejabberd aware of the domain and set a random constant resource.
At the end of the day, Ejabberd implements the XMPP protocol. So it would certainly not be a bad idea to take a look at the following book if you haven’t already: https://www.amazon.com/XMPP-Definitive-Real-Time-Applications-Technologies/dp/059652126X
necromorph23
Thanks for all the insights. Though i am facing a new problem now. I have been trying to install ejabberd in my phoenix app i am getting this error.
I have tried to downgrade ejabberd but it does not seem to be working. This is my mix.exs
Do you have any idea how can i solve this?
Hermanverschooten
Try to remove the version number.
necromorph23
Update: The app has compiled but when i start my phoenix server i am getting this error.
When i commented mod_irc in ejabberd.yml. I got this error.
Just for the context i was referring to this guide
Embedding Ejabberd in your Phoenix App
necromorph23
New updated. I just had to make few changes to ejabberd.yml it seems to be working now. my phoenix app is also running.