This commit is contained in:
Ilya Kantor 2019-08-02 14:05:34 +03:00
parent e52705e012
commit f88a41b312
4 changed files with 18 additions and 16 deletions

View file

@ -36,12 +36,13 @@ Here's an example:
let socket = new WebSocket("wss://javascript.info/article/websocket/demo/hello");
socket.onopen = function(e) {
alert("[open] Connection established, send the data -> server");
alert("[open] Connection established");
alert("Sending to server");
socket.send("My name is John");
};
socket.onmessage = function(event) {
alert(`[message] Data received: ${event.data} <- server`);
alert(`[message] Data received from server: ${event.data}`);
};
socket.onclose = function(event) {