It is a chat server based on PUBSUB. In order to make a seamless connection between web client and server, socket.io is a good way to support bidirectional message flow. Also, the application server is based on golang which have a strangth for massice transaction.
For one-to-one chat, published messages from Sender will return since the sender also do SUBSCRIBE into PUBSUB server. It may be used for acknowlegement for the sent message. But it also requires special management for UI because an user usually prefers to use legacy message experience where it shows if a message is failed to send by some reason, it should be displayed in the chat dialog so that the user recognizes and then tries again if needs. So, I think it is a redundacy for PUBSUB when it is applied for one-to-one chat.
where Sender and Receiver are subscribed to a chat room with chat-id.
In mobile environment, the state of user client can move to online to offline which means that Sender may not sucess to send a message based on the state of Receiver. So, the architecture should support store and forward approach.
The proposed architecture is using PUBSUB to endpoints which doesn't have the redundancy and some of benefits to notice the received message and manages a single connection for multiple chat rooms.
where Sender will publish to Receiver directly and messages can be delivered consistently without the state of Receiver.
Client <-> Server : Socket.io
If the receiver is online, the message will be delivered by PUBSUB.
If the receiver is offline, the message will be queued in database as bellow.

