CycloneSSE是一个Server-SentEvents(EventSource)广播服务器,基于CycloneWeb服务器构建。
安装:
virtualenv --no-site-packages env. env/bin/activatepip install cyclone-sse客户端使用:
<!doctype html><meta charset=utf-8><title>Title</title><script> sse = new EventSource('https://127.0.0.1:8888/?channels=base') sse.addEventListener('message', function(e) { console.log("Got message", e.data) }) /* Some helpful handler to have */ sse.addEventListener('open', function(e) { console.info("Opened SSE connection") }) sse.addEventListener('error', function(e) { console.error("Failed to open SSE connection") })</script>
评论