我的通知系统主页出现问题。我遵循这门课程 https://arunrocks.com/understanding-django-channels/这是我的js代码
<script src="{% static '/channels/js/websocketbridge.js' %}" type="text/javascript"></script>
<script>
document.addEventListener('DOMContentLoaded', function() {
const webSocketBridge = new channels.WebSocketBridge();
const nl = document.querySelector("#notifylist");
webSocketBridge.connect('/notifications/');
webSocketBridge.listen(function(action, stream) {
console.log("RESPONSE:", action);
if(action.event == "New User") {
var el = document.createElement("li");
el.innerHTML = `New user <b>${action.username}</b> has joined!`;
nl.appendChild(el);
}
})
document.ws = webSocketBridge; /* for debugging */
})
</script>