View embeddedstylesheet
This file contains 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> |
View stylesheetinhtmlhead
This file contains 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> |
View inlinestyle
This file contains 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> |
View websocket-client.html
This file contains 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; |
View check-for-web-socket-support.js
This file contains 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 | |
} | |
} |
View create-check-with-websocket-server.js
This file contains 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); |
View gist:a5989143e7ffb03af046
This file contains 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) }; |
View verify-opsn-web-socket.js
This file contains 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); | |
} |
View send-a-canvas-using-websockets.js
This file contains 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()); | |
// ... |
View send-array-using-websocket.js
This file contains 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