Skip to content

Instantly share code, notes, and snippets.

@maxklenk
Last active May 13, 2020 13:13
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save maxklenk/2b3fef6976b5c3e0f42e889200f94b5d to your computer and use it in GitHub Desktop.
Save maxklenk/2b3fef6976b5c3e0f42e889200f94b5d to your computer and use it in GitHub Desktop.
Load embedded Riot Chat client
<script type="text/javascript">
const matrixAssetDomain = 'https://embed.stomt.com/';
// load javascript
const riotScript = document.createElement('script');
riotScript.src = `${matrixAssetDomain}embed.js`;
riotScript.type = 'text/javascript';
document.head.appendChild(riotScript);
// setup
const options = {
riotConfig: '/config.json', // custom config
indexeddbWorkerScript: '/indexeddb-worker.js', // has to be on websites domain
assetDomain: matrixAssetDomain, // where you host the messenger files
// session
homeserverUrl: '<MATRIX_DOMAIN>',
userId: '<USER_ID>',
accessToken: '<USER_TOKEN>',
deviceId: '<USER_DEVICE>',
};
window.Matrix = window.Matrix || [];
window.Matrix.push(['setup', options]);
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment