Websocket API
Base URL
wss://api.synthdata.co/wsAuthentication
Example
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8" />
<title>Synth WebSocket API</title>
</head>
<body>
<p id="output"></p>
<script>
const apiKey = prompt("Enter your API key") || "";
const uri = `wss://api.synthdata.co/ws/insights/liquidation?asset=SOL&apikey=${encodeURIComponent(apiKey)}`;
ws = new WebSocket(uri);
ws.onopen = function () {
console.log("Connected");
};
ws.onmessage = function (evt) {
var out = document.getElementById("output");
out.innerHTML += evt.data + "<br>";
};
ws.onerror = function (err) {
console.error("WebSocket error:", err);
};
ws.onclose = function (evt) {
console.log("WebSocket closed:", evt.code, evt.reason);
};
</script>
</body>
</html>
Last updated