-
Notifications
You must be signed in to change notification settings - Fork 13
Broadcast docs #27
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Broadcast docs #27
Changes from 2 commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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,39 @@ | ||
| # Broadcast channels In Async Chat Server | ||
|
|
||
| ## Introduction | ||
|
|
||
| Broadcasting is a means of communication whereby information is transferred from a single producer to multiple consumers or receivers. Here , Broadcast channels are the channels through which broadcasting occurs. | ||
|
|
||
|
|
||
| ## Why broadcasting | ||
|
|
||
| - ### Point to Point | ||
|
|
||
| Although point-to-point communication allows multiple users to send messages, it only supports a single receiver. On the other hand, broadcasting works with SPMC (single producer, multiple consumers) channels, allowing multiple consumers to receive messages simultaneously | ||
|
|
||
| - ### Unicast | ||
|
|
||
| Here, the messages are sent from one person to another. This is not very efficient because if someone wants to send the same message to 10 people, they would need to send the message one by one, which is not ideal. Broadcasting would be preferred here, as it would make message sending easier and more efficient. | ||
|
|
||
| - ### Multicast | ||
| Multicasting is very difficult and complex to built than broadcasting .. Even though both send messages from one producer to multiple consumers, there are many aspects to handle when using multicasting that introduce complexity, while broadcasting is simpler and less complex. | ||
|
|
||
| ## Advantages | ||
|
|
||
| Some of the advantages of broadcasting are | ||
|
|
||
| - ### Efficiency | ||
| A broadcast channel is not only simple to implement but also highly efficient. It enables the transfer of messages to multiple receivers simultaneously, making it ideal for chat servers with a large number of users. | ||
|
|
||
| - ### Data Isolation | ||
| When using a broadcast channel, each user receives their own copy of the data, preventing shared access that could lead to data races. | ||
|
|
||
| - ### Concurrency Managemen | ||
micheal-ndoh marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| Even though broadcast channels work with MPSC (Multiple Producer, Single Consumer), they allow multiple users to send messages by cloning the user. This reduces potential issues that may arise if two users attempt to send messages simultaneously. | ||
|
|
||
| - ### Offline Message Retrieval | ||
| Using broadcasting allows the chat server to store built-in messages, enabling users to retrieve them if they were offline. | ||
|
|
||
|
|
||
| ## Conclusion | ||
| In conclusion, using a broadcasting channel is certainly the best choice for this chat server, as it provides efficiency, fast message retrieval, and safety. | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.