This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <head> | |
| <!-- other items in head --> | |
| <style> | |
| hr {color:sienna;} | |
| p {margin-left:20px;} | |
| body {color: black;} | |
| </style> | |
| </head> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <head> | |
| <link rel="stylesheet" type="text/css" href="mystyle.css"> | |
| </head> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <p style="color:sienna;margin-left:20px;">This is a paragraph.</p> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <!DOCTYPE html> | |
| <html xmlns="http://www.w3.org/1999/xhtml"> | |
| <head> | |
| <meta charset="utf-8" /> | |
| <title>WebSocket Test</title> | |
| <script type="text/javascript"> | |
| var wsUri = "ws://echo.websocket.org/"; | |
| var output; | |
| var socket; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function onload() { | |
| if (window.WebSocket) { | |
| // WebSocket supported | |
| } else { | |
| // WebSocket not supported | |
| } | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var wsUri = "ws://echo.websocket.org/"; | |
| var webSocket = = new WebSocket(wsUri); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| websocket.onopen = function (evt) { onOpen(evt) }; | |
| websocket.onclose = function (evt) { onClose(evt) }; | |
| websocket.onmessage = function (evt) { onMessage(evt) }; | |
| websocket.onerror = function (evt) { onError(evt) }; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function doSend(message) { | |
| if (websocket.readyState != WebSocket.OPEN) | |
| return; | |
| websocket.send(message); | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function sendBinaryMessage() { | |
| if (websocket.readyState != WebSocket.OPEN) | |
| return; | |
| var sourceCanvas = document.getElementById('source'); | |
| // msToBlob returns a blob object from a canvas image or drawing | |
| websocket.send(sourceCanvas.toBlob()); | |
| // ... |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var a = new Uint8Array([8,6,7,3,5,9.0]); | |
| websocket.send(a.buffer); |
OlderNewer