Health check API
- Print
Health check API
- Print
Article summary
Did you find this summary helpful?
Thank you for your feedback
We provide Health Checks on our services.
You may print images or run scripts in advance to avoid errors.
Existing code
function initPlayer() {
(function (s,h,o,p,l,i,v,e) {s["ShoplivePlayer"]=l;(s[l]=s[l]||function(){
(s[l].q=s[l].q||[]).push(arguments);}),(i=h.createElement(o)),
(v=h.getElementsByTagName(o)[0]);i.async=1;i.src=p;v.parentNode.insertBefore(i,v);
})(window,document,"script","https://static.shoplive.cloud/live.js","mplayer");
mplayer("init", "{{ access_key }}", "{{ campaign_key }}", "{{ user authorization }}", {{ options }});
mplayer("run", "{{ id }}");
}
Add Health Check Function
jQuery
Vanilla.js
var request;
if (window.XMLHttpRequest) {
request = new XMLHttpRequest();
} else if (window.ActiveXObject) {
request = new ActiveXObject("Microsoft.XMLHTTP");
}
request.open("GET", "https://config.shoplive.cloud/ping.json", true);
request.onreadystatechange = function() {
if (request.readyState === 4) {
if (request.status === 200) {
initPlayer();
} else {
// error handling
}
}
};
request.send(null);