The content ID is an identifier used by our backend to match Mesh sources that are watching the same content. It is an optional parameter, and by default, we generate contentId from the content URL by removing any query parameters and protocol from it.
The default contentIdGenerator
option is a function that generates a content ID from content URL.
In some cases, you might need to implement your own content ID generation logic.
-
You should be really careful that this function returns a string that identifies a content in a truly unique manner. If there's a collision, our backend is going to match Mesh sources that aren't watching the same content together, and that can lead to unpredictable results.
-
Furthermore, you should be careful that we need a content identified by the same id to be packaged in the exact same way. If you are packaging your content in an origin server and using your edge servers merely as cache servers, you're fine. If your edge servers are doing the packaging, then you shouldn't identify contents coming from different edge servers as being the same content. It is advised, then, that you don't set this optional parameter and that you use the default (full URL without the query string).
-
Be careful about elements non-related to the content in your id. For example, if you derive your content id from its URL, and you have a user-specific token in your query string, you're going to have to strip that token from the id. Same thing if you have query parameters identifying the device, you'll want to remove them if your content is packaged the same for all devices (but keep it if the content is different for mobile and desktop for example).
contentId - string (optional)
The value can't be null nor empty.
builder.contentId(<String>);