Menu

Expand
Rate this page:

Stream Resource

A Stream is a pub-sub primitive that lets you broadcast JSON messages at a high rate to an elastic group of subscribers.

  • Messages are ephemeral - they can be published (created), but they cannot be queried, updated or deleted
  • The maximum Message payload size as serialized JSON is 4KB.
  • The maximum Message publishing rate per Stream is 30 per second.
  • Message delivery to remote endpoints is not guaranteed.
  • Messages may be received by remote endpoints in a different order than they were published.

See also Stream Message for information about the messages in a stream.

Sync Stream properties

Resource Properties in REST API format
sid
sid<TO> Not PII

The unique string that we created to identify the Sync Stream resource.

unique_name

An application-defined string that uniquely identifies the resource. It can be used in place of the resource's sid in the URL to address the resource.

account_sid
sid<AC> Not PII

The SID of the Account that created the Sync Stream resource.

service_sid
sid<IS> Not PII

The SID of the Sync Service the resource is associated with.

url
url Not PII

The absolute URL of the Message Stream resource.

links
uri_map Not PII

The URLs of the Stream's nested resources.

date_expires
date_time<iso8601> Not PII

The date and time in GMT when the Message Stream expires and will be deleted, specified in ISO 8601 format. If the Message Stream does not expire, this value is null. The Stream might not be deleted immediately after it expires.

date_created
date_time<iso8601> Not PII

The date and time in GMT when the resource was created specified in ISO 8601 format.

date_updated
date_time<iso8601> Not PII

The date and time in GMT when the resource was last updated specified in ISO 8601 format.

created_by

The identity of the Stream's creator. If the Stream is created from the client SDK, the value matches the Access Token's identity field. If the Stream was created from the REST API, the value is 'system'.

Create a Sync Stream resource

post
https://sync.twilio.com/v1/Services/{ServiceSid}/Streams
Parameters
Parameters in REST API format
service_sid
Path
post sid_like<IS> Not PII

The SID of the Sync Service to create the new Stream in.

unique_name
Optional
post string PII MTL: 30 DAYS

An application-defined string that uniquely identifies the resource. This value must be unique within its Service and it can be up to 320 characters long. The unique_name value can be used as an alternative to the sid in the URL path to address the resource.

ttl
Optional
post integer Not PII

How long, in seconds, before the Stream expires and is deleted (time-to-live).

Example 1
Loading Code Sample...
        
        

        Create a Sync Stream resource

        Fetch a Sync Stream resource

        get
        https://sync.twilio.com/v1/Services/{ServiceSid}/Streams/{Sid}
        Parameters
        Parameters in REST API format
        service_sid
        Path
        get sid_like<IS> Not PII

        The SID of the Sync Service with the Sync Stream resource to fetch.

        sid
        Path
        get sid_like<TO> Not PII

        The SID of the Stream resource to fetch.

        Example 1
        Loading Code Sample...
              
              

              Fetch a Sync Stream resource

              Read multiple Sync Stream resources

              get
              https://sync.twilio.com/v1/Services/{ServiceSid}/Streams

              Note: Without a PageSize query parameter, this will return only the first 50 Message Streams. Add a PageSize query parameter to fetch up to 100 items at once. The example has a PageSize value of 20.

              See paging for more information.

              Parameters
              Parameters in REST API format
              service_sid
              Path
              get sid_like<IS> Not PII

              The SID of the Sync Service with the Stream resources to read.

              Example 1
              Loading Code Sample...
                    
                    

                    Read multiple Sync Stream resources

                    Update a Sync Stream resource

                    post
                    https://sync.twilio.com/v1/Services/{ServiceSid}/Streams/{Sid}
                    Parameters
                    Parameters in REST API format
                    service_sid
                    Path
                    post sid_like<IS> Not PII

                    The SID of the Sync Service with the Sync Stream resource to update.

                    sid
                    Path
                    post sid_like<TO> Not PII

                    The SID of the Stream resource to update.

                    ttl
                    Optional
                    post integer Not PII

                    How long, in seconds, before the Stream expires and is deleted (time-to-live).

                    Example 1
                    Loading Code Sample...
                          
                          

                          Update a Sync Stream resource

                          Delete a Sync Stream resource

                          delete
                          https://sync.twilio.com/v1/Services/{ServiceSid}/Streams/{Sid}
                          Parameters
                          Parameters in REST API format
                          service_sid
                          Path
                          delete sid_like<IS> Not PII

                          The SID of the Sync Service with the Sync Stream resource to delete.

                          sid
                          Path
                          delete sid_like<TO> Not PII

                          The SID of the Stream resource to delete.

                          Example 1
                          Loading Code Sample...
                                
                                

                                Delete a Sync Stream resource

                                Rate this page:

                                Need some help?

                                We all do sometimes; code is hard. Get help now from our support team, or lean on the wisdom of the crowd by visiting Twilio's Stack Overflow Collective or browsing the Twilio tag on Stack Overflow.

                                Loading Code Sample...
                                      
                                      
                                      

                                      Thank you for your feedback!

                                      Please select the reason(s) for your feedback. The additional information you provide helps us improve our documentation:

                                      Sending your feedback...
                                      🎉 Thank you for your feedback!
                                      Something went wrong. Please try again.

                                      Thanks for your feedback!

                                      thanks-feedback-gif