switched to SSE transport, seems to work
This commit is contained in:
@@ -57,3 +57,12 @@ function gooseAppendMessage(id, type, timestamp, username, text, icon) {
|
||||
/* autoscroll to the end */
|
||||
window.scrollTo(0, document.body.scrollHeight)
|
||||
}
|
||||
|
||||
/* entry point, set up an event source */
|
||||
window.addEventListener('DOMContentLoaded', function() {
|
||||
var msgSource = new EventSource('/sse')
|
||||
msgSource.onmessage = e => {
|
||||
var msg = JSON.parse(e.data)
|
||||
gooseAppendMessage(msg.id, msg.type, msg.timestamp, msg.username, msg.text, msg.icon)
|
||||
}
|
||||
}, false)
|
||||
|
||||
Reference in New Issue
Block a user