Download test_client.html from AnthropicallyHuggingFaces/klaw-sync-console: direct link, hf CLI and curl.
- Browser
- Download file 988 Bytes
-
https://huggingface.co/spaces/AnthropicallyHuggingFaces/klaw-sync-console/resolve/main/test_client.html
- Command line
-
hf download hf://spaces/AnthropicallyHuggingFaces/klaw-sync-console/test_client.html
-
curl -L -o test_client.html https://huggingface.co/spaces/AnthropicallyHuggingFaces/klaw-sync-console/resolve/main/test_client.html
988 Bytes
| <meta charset="utf-8"><title>klaw-sync test</title> | |
| <body style="font-family:monospace;padding:16px;background:#0b0f17;color:#cde"> | |
| <h3>klaw-sync WebSocket test</h3> | |
| <input id="u" size="60" placeholder="wss://host/ws?workspace=phoenix-default"> <button onclick="go()">connect</button> | |
| <button onclick="pull()">pull</button> <button onclick="patch()">patch(+counter)</button> | |
| <pre id="o"></pre> | |
| <script> | |
| let ws,rev=0,state={};const o=document.getElementById('o');const log=m=>o.textContent=(typeof m==='string'?m:JSON.stringify(m)).slice(0,2000)+"\n"+o.textContent; | |
| function go(){ws=new WebSocket(document.getElementById('u').value);ws.onopen=()=>{log('open');pull()};ws.onmessage=e=>{const m=JSON.parse(e.data);if(m.op==='state'){rev=m.rev;state=m.state;}log(m)};ws.onclose=()=>log('closed')} | |
| function pull(){ws.send(JSON.stringify({op:'pull'}))} | |
| function patch(){state.counter=(state.counter||0)+1;ws.send(JSON.stringify({op:'patch',baseRev:rev,state}))} | |
| </script></body> | |