Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <body>
- <script>
- var Socket = new WebSocket("ws://localhost:778");
- Socket.onopen = function() {
- alert("Connection established");
- };
- Socket.onclose = function(event) {
- if (event.wasClean) {
- alert('Connection closed clean');
- }
- else {
- alert('Connection aborted'); // например, "убит" процесс сервера
- }
- alert('Code ' + event.code + ' Reason ' + event.reason);
- };
- Socket.onmessage = function(event) {
- alert("Data received " + event.data);
- };
- Socket.onerror = function(error) {
- alert("Error " + error.message);
- };
- </script>
- </body>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement