-1

I need to add a chat in my application to let users contact each others.

Requirements

  • only 1 to 1 communication customer 2 customer (no group or chat room)
  • essentially text, image upload is a bonus (probably as a second step)
  • message must be delivered in a reasonable delay (maybe ... 20 sec max)
  • max load: 3M chat msg / days,

Protocol / API

I only have way back memories from the university and the TCP sockets, a recent trial to gRPC & protocol buffers but none of these looks like a good fit.

Web Socket ?

Then, I've found some articles about the Web Socket protocol and an implementation in Go from the Gorilla team and the Web Socket API from MDN

HTTP/3 ?

I also take a look at nsq but it looks like a Rube Goldberg machine in this context.

PubSub API

Google provides a PubSub API that can be connected to BigQuery and Dataflow

Persistence ... ?

Cassandra or MongoDB look like good options here... Firebase Realtime database / Firestore? Advantage here is to abstract a lot of complexity, we just send data and subscribe to updates. Not sure about the cost efficiency vs the other solutions.

A complete solution has been given by minghsu0107 here: go-random-chat...I'm not skilled enough to have any thought on this architecture. The only thing I'm thinking about is that this solution is maintained by a single person ... which mean if I chose to use it, I must be able to understand every single piece of it. So if someone could just set me on the "right" path, or at least to move me away from the "wrong" ones before I spend weeks on these concepts, that'd be awesome :D

Big_Boulard
  • 799
  • 1
  • 13
  • 28

2 Answers2

2

Given the background you've supplied, I think you'd be better off integrating an open-source, off-the-shelf messaging plugin, rather than trying to build your own.

Something like Rocket or Zulip might suit (and save you a lot of grief).

Buffoonism
  • 1,669
  • 11
  • 11
  • these Slack-like solutions are not focused on 1 to 1, customer 2 customer, conversation, so it seems a bit besides the point at first blush, but interesting to know anyway – Big_Boulard Aug 15 '22 at 21:35
1

I am the author of go-random-chat. The main difference between 1-to-1 and group chat is that the message status in 1-to-1 chat is either seen or unseen, whereas in group chat it's a counter to record the number of users that have seen the message. Therefore, you can still refer to those Slack-like implementations besides go-random-chat to see how messaging works under the hood.