turms icon indicating copy to clipboard operation
turms copied to clipboard

rich media

Open water2060 opened this issue 1 year ago • 3 comments

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 avatar Feb 26 '24 02:02 water2060

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

water2060 avatar Feb 26 '24 03:02 water2060

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: 文件存储

JamesChenX avatar Feb 26 '24 13:02 JamesChenX

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? 2. Is "uploadMessage Attachment" to upload an attachment and then save the corresponding "attachment ID" in the "text" field of "message", or what field?

water2060 avatar Feb 27 '24 03:02 water2060