GET
/v1/user/{user_id}
https://api.ame.nattapat2871.me/v1/user/1007237437627572275
GET
/v1/user/{user_id}.svg
https://api.ame.nattapat2871.me/v1/user/1007237437627572275.svg
WS
/ws/v1/user/{user_id}
const userId = "1007237437627572275";
const socket = new WebSocket(`wss://api.ame.nattapat2871.me/ws/v1/user/${userId}`);
socket.onopen = () => console.log("✅ WebSocket connection established!");
socket.onmessage = (event) => {
const userData = JSON.parse(event.data);
console.log("🔥 New JSON data received:", userData);
};
socket.onclose = (event) => console.log("🔌 WebSocket connection closed.", event.reason);
socket.onerror = (error) => console.error("❌ WebSocket error:", error);
WS
/ws/v1/user/{user_id}/svg
<div id="live-svg-container"></div>
const userId = "1007237437627572275";
const svgContainer = document.getElementById('live-svg-container');
const socket = new WebSocket(`wss://api.ame.nattapat2871.me/ws/v1/user/${userId}/svg`);
// On update from the server
socket.onmessage = (event) => {
// Server sends the FULL updated SVG string (calculated on server)
console.log("🔥 New SVG image received!");
svgContainer.innerHTML = event.data;
};
/v1/user/{user_id}:/v1/user/{user_id}.svg: