-
Notifications
You must be signed in to change notification settings - Fork 141
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: 《分布式IM即时通讯系统》-大后端平台-消息微服务-第09节
- Loading branch information
binghe001
committed
Jan 28, 2024
1 parent
ae5e98b
commit f3afa8d
Showing
6 changed files
with
56 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
52 changes: 52 additions & 0 deletions
52
docs/md/project/im/platform/message/2024-01-29-chapter09.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
--- | ||
title: 第09节:图片、文件和语音消息的设计和实现 | ||
pay: https://articles.zsxq.com/id_1f32q87wrs3h.html | ||
--- | ||
|
||
# 《分布式IM系统》大后端平台-消息服务-第09节:图片、文件和语音消息的设计和实现 | ||
|
||
作者:冰河 | ||
<br/>星球:[http://m6z.cn/6aeFbs](http://m6z.cn/6aeFbs) | ||
<br/>博客:[https://binghe.gitcode.host](https://binghe.gitcode.host) | ||
<br/>文章汇总:[https://binghe.gitcode.host/md/all/all.html](https://binghe.gitcode.host/md/all/all.html) | ||
<br/>源码获取地址:[https://t.zsxq.com/0dhvFs5oR](https://t.zsxq.com/0dhvFs5oR) | ||
|
||
> 沉淀,成长,突破,帮助他人,成就自我。 | ||
* 本节难度:★★☆☆☆ | ||
* 本节重点:对通用文件的上传功能进行设计和实现,从源码级别掌握文件上传到Minio文件系统的流程,重点理解用户上传文件的流程,以及在消息发送过程中文件的随消息的流转过程,结合自身实际项目思考,将本节学到的知识灵活应用到自身实际项目中。 | ||
|
||
**大家好,我是冰河~~** | ||
|
||
不知道小伙伴们有没有发现这样一个问题,目前我们实现的大后端平台的消息微服务虽然能够实现单聊消息和群聊消息的发送流程和拉取流程,也能够实现消息的未读和已读功能,还能够实现消息的撤回。但是,到目前为止,没看到在分布式IM即时通讯系统中如何发送图片、文件、语音功能呀,那怎么实现呢? | ||
|
||
## 一、前言 | ||
|
||
对于分布式IM即时通讯系统来说,在设计上支持的消息类型涵盖:**文字、图片、文件、语音、视频**,也就是说,在我们实现的分布式IM即时通讯系统中,可以**发送文字、图片、文件、语音、视频**。目前,我们已经实现了文字消息的发送、拉取、未读、已读和撤回功能。那图片、文件、语音、视频类型的消息如何处理呢? | ||
|
||
## 二、功能描述 | ||
|
||
文字消息比较简单,目前我们已经在分布式IM即时通讯系统中实现了文字消息的流转过程,也就是说,你可以在分布式IM即时通讯系统中顺畅的发送和撤回文字消息了。 | ||
|
||
对与其他类型的消息来说,我们可以将图片、文件、语音归为一类,这类消息在实现时,我们可以将图片、文件、语音上传到Minio文件系统,随后图片、文件和语音的链接随消息进行流转,当用户收到图片、文件和语音类型的消息时,从Minio文件系统中拉取消息即可。 | ||
|
||
而视频类型的消息,则需要通过实时推送和接收视频流来实现。 | ||
|
||
## 三、流程设计 | ||
|
||
针对图片、文件、语音类型的消息,在流程设计上,我还是分成单聊消息流程和群聊消息流程进行讲解。 | ||
|
||
### 3.1 单聊消息流程 | ||
|
||
单聊场景发送图片、文件、语音类型的消息流程如图9-1所示。 | ||
|
||
<div align="center"> | ||
<img src="https://binghe.gitcode.host/images/project/im/2024-01-29-001.png?raw=true" width="70%"> | ||
<br/> | ||
</div> | ||
|
||
可以看到,整体流程还是比较简单的,主要涉及到用户及其好友、消息微服务、消息库、即时通讯SDK、消息中间件、即时通讯后端服务等 | ||
|
||
## 查看完整文章 | ||
|
||
加入[冰河技术](http://m6z.cn/6aeFbs)知识星球,解锁完整技术文章与完整代码 |