Websocket, first stage
This commit is contained in:
parent
19f31a1b4e
commit
ba5c769f81
|
@ -46,3 +46,13 @@ var app = new Vue({
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
var exampleSocket = new WebSocket("ws://127.0.0.1:8000/ws");
|
||||||
|
exampleSocket.onopen = function (event) {
|
||||||
|
console.log("WS: Connection open!");
|
||||||
|
console.log("Proto: " + exampleSocket.protocol);
|
||||||
|
};
|
||||||
|
exampleSocket.onmessage = function (event) {
|
||||||
|
item = JSON.parse(event.data);
|
||||||
|
app.items.push(item);
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in a new issue