Skip to content

Instantly share code, notes, and snippets.

@Csqhi515
Created October 15, 2021 11:15
Show Gist options
  • Save Csqhi515/46900f379e43ed597ad89671eea70e51 to your computer and use it in GitHub Desktop.
Save Csqhi515/46900f379e43ed597ad89671eea70e51 to your computer and use it in GitHub Desktop.
//Displays csgoexo pricelist
function wsGet() {
const socket = new WebSocket('wss://csgoexo.com/socket.io/?EIO=3&transport=websocket');
socket.addEventListener('message', function (event) {
if (event.data.indexOf('["pricelist"') > -1) {
priceListHandler(event.data);
socket.close();
}
});
}
function priceListHandler(data) {
data = JSON.parse(data.substring(2))[1];
var html = '';
html += '<p>Count: ' + Object.keys(data).length + '</p>';
for (var k in data) {
html += `<p>${k} : $${data[k]}</p>`;
}
var e = document.querySelector('#__layout');
e.classList.add('p-3', 'text-white'); e.innerHTML = html;
}
wsGet();
setInterval(wsGet, 15000);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment