turms-im / turms

🕊️ The world's most advanced open source instant messaging engine for 100K~10M concurrent users https://turms-im.github.io/docs
Apache License 2.0
1.69k stars 256 forks source link

rich media #1398

Open water2060 opened 4 months ago

water2060 commented 4 months ago

Does the message sent support rich media? For example, if I want to send an emoji, an image, or a video while chatting, how should I achieve this?

water2060 commented 4 months ago

Is this image, video, and file also saved in Mongo?

JamesChenX commented 4 months ago

Does the message sent support rich media? For example, if I want to send an emoji, an image, or a video while chatting, how should I achieve this?

Turms clients can send a string and arbitrary binary data as messages via turmsClient.sendMessage, which means you can pass anything. Just as Markdown, HTML, or others work, it's up to the client to implement to decide how to parse and display the string and binary data in messages.

I suggest people implement their representation based on Markdown because Markdown has a strong ecosystem, there are a lot of Markdown rendering/editor libraries you can use out of the box. If you have custom business requirements that Markdown doesn't support, you can add your implementation based on the Markdown.


Take an example, I draw a pie below based on the pure text:

pie title NETFLIX
         "Time spent looking for movie" : 90
         "Time spent watching it" : 10

Output:

pie title NETFLIX
         "Time spent looking for movie" : 90
         "Time spent watching it" : 10

Is this image, video, and file also saved in Mongo?

Use object storage service, e.g. AWS S3, MinIO. It's unprofessional to store files in MongoDB usually.

For more details, you can read: English: File Storage Chinese: 文件存储

water2060 commented 4 months ago

1.If MinIO is used for storing files, images, and videos, while mongoDB only stores the corresponding addresses. How does the system distinguish whether the current address in the message is a randomly entered address by the user or a link to a file, image, or video?

  1. Is "uploadMessage Attachment" to upload an attachment and then save the corresponding "attachment ID" in the "text" field of "message", or what field?