Advertisement
s243a

Websocket Example - JavaScript

Nov 3rd, 2018
302
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 0.35 KB | None | 0 0
  1. # https://bottlepy.org/docs/dev/async.html
  2. <!DOCTYPE html>
  3. <html>
  4. <head>
  5. <script type="text/javascript">
  6.     var ws = new WebSocket("ws://example.com:8080/websocket");
  7.     ws.onopen = function()
  8.     {
  9.         ws.send("Hello, world"); };
  10.         ws.onmessage = function (evt)
  11.            { alert(evt.data); };
  12. </script>
  13. </head>
  14. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement