Table of Contents

Live streaming and live events with Sendbird

Live streaming and live events with Sendbird

Jason Allshorn
Reading Time: 10 Mins Building Time: 1 - 2 Hours

Background

SendBird can be leveraged to bring further interactivity to your live streaming event. This document sets out how to work with many 1000s of users attending a live event.

Live events attract many users who would like to participate and contribute to a live chat streaming experience. The chat may exist as its own service or may appear alongside media streaming from a live event. 

Below is an image from a SendBird sample that depicts live chat streaming for an online gaming event.

Implementation quickstart

It’s easy to get up and running quickly with Sendbird’s existing sample apps. Before running the sample, review the “Channels Overview” section below to create chats ahead of time that users can quickly join into.

JavaScript Web live chat sample

  1. Download the sample
  2. Follow the setup guide from the the repro’s Read.me 

iOS chat sample

  1. Download the basic sample.
  2. Open the sample in Xcode. In Main.storyboard, remove the “Group Channels Scene” and “GroupChannelsViewContoller Scene”. Any Group Channel code can be removed from the sample as this will not be needed for live streaming chats.
  3. Run the sample to add users and show the “Open Channel” list of your channels.


Android chat sample

  1. Download the basic sample.
  2. Open the sample in Android Studio. In android_main.xml, remove the LinearLayout “linear_layout_group_channels”. In MainActivity.java, remove this method call:
findViewById(R.id.linear_layout_group_channels).setOnClickListener(new View.OnClickListener()

Any Group Channel code can be removed from the sample as this will not be needed for live streaming chats.

  1. Run the sample to add users and show the “Open Channel” list of your channels.

Channels overview

An open channel is a public chat by nature that can handle a large number of online users. A single open channel can accommodate thousands of simultaneous users in a Twitch-style public chat, and anyone can easily participate without permission. This maximum number of participants can increase per request (The participant default size is 5,000 in a shared instance, and can go up to 10,000 on a shared instance. The participant maximum size can go up to 100,000 on dedicated instances). Where applicable, Super Groups may also provide a solution for live events or live streaming.

Channel size and scalability

  • Preparation: Consider Informing SendBird of your event size in advance.
    SendBird has the capacity to automatically scale to meet your needs. However, providing advance notice with your projected user size will help to make sure that your event runs smoothly without reaching any upper limits of our scalability.
  • Create dynamically partitioned open channels in advance.
    Note: Please submit a request to SendBird (through support@sendbird.com or your existing account manager) to enable dynamic partitioned channels by providing the application_id(s) which you would like to enable it for. Also please describe your use case for dynamic partitioned channels by mentioning “livestreaming”.

Channel creation can be achieved programmatically via Platform API. Or, if only creating a few channels, create these open channels on the Sendbird Dashboard.

Consider calculating how many channels you will need and how long it will take to create them. When creating through the API, you should account for throttling channel creation to less than 30 per second.


To create a dynamic partitioned channel through the API, you need to create an open channel while passing in the argument is_dynamic_partitioned = True. Documentation for Creating Open Channels through the API is available here: https://docs.sendbird.com/platform/open_channel#3_create_a_channel

cURL Command

curl -X POST \
  https://api-<APP_ID>.sendbird.com/v3/open_channels \
  -H 'Api-Token: <APP_TOKEN>' \
  -H 'Content-Type: application/json' \
  -F is_dynamic_partitioned=True

Please verify that the response from the API call should include is_dynamic_partitioned = True to confirm your channel is dynamically partitioned.

{
    "name": "open channel",
    "participant_count": 0,
    "custom_type": "",
    "is_ephemeral": false,
    "channel_url": "sendbird_open_channel_101_2e90b7dc3736e4c0e8864de2d077e9306d7f7c80",
    "created_at": 1569285995,
    "cover_url": "https://sendbird.com/main/img/cover/cover_05.jpg",
    "freeze": false,
    "is_dynamic_partitioned": true,
    "max_length_message": -1,
    "data": "",
    "operators": []
}
  • Dynamic Partitioning is an open channel feature where users are separated into virtual groups to maintain the load of each group as well as to control the chat experience within the channel. When users send messages to the channel, their messages are inserted into their virtual group only. When channel operators (administrators) send a message into the channel, all groups will see their messages.

How does it work?
Incoming users – users that are joining the channel – are always inserted into the smallest available “shard”. Each shard is filled up until a certain threshold with users, called the Allocation Ratio (default: 50% user capacity).

If all shards are already filled to the Allocation Ratio, then a new shard will be created. If a channel has hit the maximum number of shards possible, then the existing shards will be filled over the allocation ratio’s threshold and the user will be added to all existing shards in a “round-robin” manner.

Through this system, there is no splitting one shard’s users into multiple shards. Each member should be in the shard they started in unless the shard has under the Deallocation Ratio (default: 5% of the shard occupancy) for a certain amount of time. Under those conditions, the smallest shard will have all of its users moved to the next smallest shard.

If the new user is an operator, they will access the channel as if it is not sharded, i.e. they will hear everything said in every shard and the operator’s messages will be visible in every shard.

Moderation

  • When 1000s of users are involved in live events, consider how the messages they send and the actions they take will affect the user experience as a whole. 
  • It is recommended that much consideration be given to providing several human moderators for live events. Sendbird’s experience suggests that 1:1000 ratio of moderators to channel members brings value to the live chat experience.
  • To help with moderation, SendBird provides extensive moderation tools, both automated and manual. 

Dashboard moderation tools

SendBird Dashboard moderation offers many moderation functions right within the chat. 

  • View chat users
  • Mute users
  • Ban users
  • View messages

Delete messages

Further Moderation Options

Profanity filtering

  • There is built in message text moderation via profanity filter. 
  • Sendbird’s experience suggests that profanity filtering may not be necessary across all conversations. However applying profanity filtering to the live event use case is highly recommended. 
  • It is possible to direct profanity filtering to a particular sendbird channel custom_type.
  • Sendbird also provides an automatic, so called three strikes and you are out, functionality (profanity filtered moderation). 
    • With this feature it is possible to set the parameters for either banning, kicking or muting chat channel members depending on the number of times they trigger the profanity filter.  
  • Sendbird also provides a web-hook for when a profanity moderation event is triggered.

Domain filtering

  • The domain filter allows you to set the domains to be detected in URL-containing text and file messages as well as users’ profile images. 
  • It will filter the detected domains according to your policies and criteria. 
  • This tool is particularly useful in preventing unwanted advertising and obscene website sharing. Consider also the use of image moderation to detect and filter images users are sharing.
  • Sendbird also provides a web-hook for when a domain moderation event is triggered.

Image moderation

  • Image moderation SendBird has a built-in fully automated image moderation service which can moderate images stored both in SendBird and images stored externally. 
  • The same service can also detect and block images shared with URLs in messages. There is an implementation guide here. 

Channel Freeze

  • In summary a frozen channel provides the ability for channel operators to send messages and normal channel members cannot send messages. 
  • Freezing a channel can be useful during a live event as it provides the implementation the ability to “pause” the whole channel while still allowing needed operations. 
  • There is an in depth channel freeze FAQ here.
  • When a channel is frozen the following logic applies:
    • Non-operator members of the channel cannot update the channel with messages. 
    • Non-operator members are able to read messages. 
    • Non-operator members are able to perform other channel operations other than send messages.
    • Channel Admins can still send messages from the dashboard, or via Platform API. 
    • Channel Operators also can still send messages, via SDK or Platform API. 
    • Channels can be frozen as below:

Ban or mute users

  • Channel operators as well as sendbird’s Platform API provides the ability to ban or mute channel members. 
  • This service bans a user from an open channel. A banned user is immediately expelled from a channel and allowed to participate in the channel again after a set time period.
  • If user A blocks user B, user B’s messages will automatically be hidden from user A.
    • Imagine if user B was a bad actor or a spammer – if all the good users actively blocked user B, the chat experience wouldn’t be negatively impacted for the good users and the bad users would not be getting any attention. 
  • There is also a service which mutes a user in the channel. A muted user remains in the channel and is allowed to view the messages, but can’t send any messages until unmuted. Users can be banned and muted within sendbird’s Dashboard moderation view or as below: 

Spam flood protection

  • This feature allows you to customize the number of messages a participant can send in an open channel per second. By doing so, all excess messages from a participant will be deleted and only the number of messages allowed to be sent per participant per second will be delivered. This feature protects your app from some participants spamming others in the channel with the same messages.
  • Note: Our default system setting is 5 messages per second. This limit can be manually adjusted only from our side. You can contact our engineering team about this setting. This is one of Sendbird’s premium features, first contact our sales team for further assistance.

Pre-event webhooks

  • With pre-event webhooks a moderator or other service is able to capture, process and review an incoming message before it is forwarded to all members of a channel. 
  • This means inappropriate messages can be removed or modified. 

Reporting API:

Question and answer: Ask me anything events

  • “Ask my anything” in this context relates to the condition where a celebrity, influencer, or famous person is available for a live chat experience that can be found in Sendbird
  • These recommendations may also apply to live ecommerce events where moderators are taking questions from online shoppers.

Question Format

  • Consider how your celebrity/moderator will receive their questions. If there are 10,000 members in a channel freely asking questions will lead to a long list of streaming messages making it difficult to see the questions. Therefore, consider reducing the number of members who can ask a question. 
    • Consider providing a gate in front of the channel members so the members may not freely ask questions. 
      • The gate may be in the form of a paywall, where payment is through points, money, status or recommendation.
      • The gate could be a time based wall where users are able to submit their questions within particular time slots, either before the event starts or for short bursts during the event.
      • The wall could also be in the format of providing each user with a restricted number of questions they can ask, and in a first come first serve format.

Message pinning queue

  • Consider providing the celebrity and channel moderators (called channel operators in sendbird palance) the ability to pin messages. 
    • By default, Sendbird Channel operators are able to update any channel member’s messages. 
    • Therefore, consider offering channel operators the ability to  update a message’s data field to include a flag to pin the message. 
    • The pinned message can then be added to a queue of questions that is visible to both the celebrity and all of the other channel members. 
    • Once the question has been answered it can be unpinned.