rahulsharma

rahulsharma

Hello,

I’ve built an application in Phoenix/Elixir which is more like a real-time polling application (like a big chat room). I’m currently exploring the option of building a chat application using Phoenix/Elixir. I went through different threads of Elixir forum in order to understand how I can achieve the same. I found this reply from Chris where he mentions keeping two channels. I’ve also gone through this thread where the end solution seemed to be Contus Fly.

Well I have gone ahead with Chris’s idea and also written some code but I was stuck with the problem of delivering offline messages. I’m thinking of storing all the topics for which the user has subscribed and when the user comes online I can push all the stored messages in different topics to the client (while also sending push notifications for the messages as and when they arrive on the server). But I’m confused where to store the messages till it has been successfully received by the client. Will it be a good idea to store the messages in a central database (Redis/Mongo) or somewhere else. I’m looking for a store-and-forward solution here.

Thanks

Showing Posts 1 to 5

idi527

idi527

But I’m confused where to store the messages till it has been successfully received by the client.

In a voice messaging app I store (encrypted by the sender) messages that haven’t been delivered in a database.

JeyHey

JeyHey

MongooseIM (a fork of ejabberd - the xmpp server Whatsapp started with) also stores undelivered messages in a database until they are delivered. What would be the alternative you are thinking of?

rahulsharma

rahulsharma OP

I stumbled upon this video where several use cases are mentioned for storing offline messages which led to my confusion. I was thinking of may be using a queue here. That way I can have some retry mechanism for sending the messages until I don’t get an ACK from the client. This way I can achieve more reliable message delivery in case of both online and offline clients.

JeyHey

JeyHey

I think the main cases of the slide are:

  • there is a session for the destinatary: (i) keep the message in memory; try to deliver it; and delete it once an ack is received. (ii) additionally persist all unacked messages when the session ends.

  • there is no session for the destinatary: persist all messages; try to deliver them upon the next session and delete them once acked.

sienna

sienna

Ill give Peculiar solution for your problem. It is the 2 best way to store & retrieve messages in Database.

Server-side database:

where the messages sent are stored in the server database. This results in the storage of a vast amount of data in the server-side data storage. ex : (Slack Hipchat)

On the other hand,

Client-side database :

It is quite effective in minimizing the data stored in the database by holding the data within the device & diminishing the queuing of messages and consumption of data. ex: (Whatsapp, Viber)

Languages:

Server Side Database: Mysql,PosygreSQL.RIAK
Client-side Database : Android -> sqllite, iOS -> Realm DB , Web -> No database

P.S: I am Erlang developer in Mirrorfly. My colleague wrote this blog. Check this as reference Enterprise Chat Database Architecture: Complete Guide (2026)

— All posts loaded —

Where Next? Top

Trending in Questions Top

stjefim
Hello! Suppose you are building workflow (order / task / payment) processing system with the following requirements: Each workflow con...
New
Blokh
Hey guys, I’ve got a huge CSV ( around 10 GB ) that needs to be processed hourly Do you guys have any suggestions what is the best prac...
New
roeland
Kia ora, We have been using elixir-google-api to connect to Google Drive. However, with the updates to Tesla due to CVEs this is now bro...
New
kszambelanczyk
Hello! Could someone please give me a help/sample code, how to delete a file from s3 using waffle/waffle_ecto from Phoenix app. I creat...
New
Onor.io
I have what I’ve heard referred to as a “lookup table” in my database. This is a way of assigning codes to common values. One common lo...
New
jaybe78
Hello, I’m developing a online persistent chat system (what’s app) like using elixir/dynamodb/aws for a mobile app(flutter). The diffic...
New
Trolleger
What approach to take when sending live updates to “random” users Hi! I have a question, I have a little chat app, and when I create a DM...
New

Other Trending Topics Top

garrison
Hobbes is a low-level distributed database for the Elixir programming language. Hobbes provides a simple, safe, and scalable storage lay...
New
mcass19
ExRatatui lets you cook up rich terminal UIs in Elixir, powered by Rust’s ratatui via Rustler NIFs. Build interactive terminal applicatio...
New
Damirados
Hello everyone. After busy few months I am happy to announce v0.1.0 of Emerge & Solve. They are GUI (Emerge) and State management (S...
New
netoum
Corex is an accessible, unstyled UI component library for Phoenix that integrates Zag.js state machines using Vanilla JavaScript and Live...
New
wintermeyer
There are three potential reasons for members of this forum to have a look at https://vutuv.de You are tired or annoyed of LinkedIn. Yo...
New
aseigo
ICal is a library for interacting with iCalendar data. It parses iCalendars into typed Elixir structs via ICal.from_ics, and can prepare ...
New

We're in Beta

About us Mission Statement

Options

Thread Display Mode




Thread Preview

Skip Thread Previews