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> | |
<head> | |
<meta charset="utf-8"> | |
<script src="https://code.jquery.com/jquery-2.1.4.min.js"></script> | |
<script src="https://skyway.io/dist/0.3/peer.min.js"></script> | |
</head> | |
<body> | |
<!-- 接続処理用のform --> | |
<form id="connect"> |
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 express = require('express'); | |
var http = require('http'); | |
var path = require('path'); | |
// Expressの設定 | |
var app = express(); |
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 str2buff = function(str){ | |
var ab_ = new ArrayBuffer(new Blob([str]).size); | |
var bytes_ = new Uint8Array(ab_); | |
var n = str.length, | |
idx = -1, | |
i, c; | |
for(i = 0; i < n; ++i){ | |
c = str.charCodeAt(i); |
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
html = <<EOS | |
<!DOCTYPE html> | |
<html> | |
<head> | |
<title>W3C WebSocket API - Close WebSocket - Code is 0</title> | |
<script type="text/javascript" src="/resources/testharness.js"></script> | |
<script type="text/javascript" src="/resources/testharnessreport.js"></script> | |
<script type="text/javascript" src="websocket.js"></script> | |
</head> | |
<body> |
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
app.configure(function(){ | |
app.set('port', process.env.PORT || 3000); | |
app.set('views', __dirname + '/views'); | |
app.set('view engine', 'ejs'); | |
app.use(express.favicon()); | |
app.use(express.logger('dev')); | |
app.use(express.bodyParser({uploadDir:'./uploads'})); | |
app.use(express.methodOverride()); | |
app.use(allowCrossDomain); | |
app.use(app.router); |
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
$("<canvas>").appendTo("body"); | |
var canvas = $("canvas")[0] | |
, ctx = canvas.getContext('2d') | |
canvas.width = 640, canvas.height = 480; | |
for(var i = 0, l = ent.length; i < l; i++) { | |
var imgURL = ent[i]; | |
var img = new Image(); |
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> | |
<head> | |
<meta charset="utf-8"> | |
</head> | |
<body> | |
<script src="peer.js"></script> | |
<video id="local"></video> | |
<video id="remote"></video> | |
<button id="start0">start as 0(caller)</button> |
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> | |
<head> | |
<meta charset="utf-8"> | |
<script src="./lib/jquery-1.9.1.min.js"></script> | |
</head> | |
<body> | |
<div class="input"></div> | |
<div class="output"></div> | |
</body> |
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> | |
<head> | |
<script type="text/javascript" src="./lib/jquery-1.9.1.min.js"></script> | |
<script type="text/javascript" src="./lib/peer.js"></script> | |
</head> | |
<body> | |
<form id="connect"> | |
<strong>connect to broker</strong><br> |
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
/** | |
* A remote controller code for Google presentation. | |
* | |
* At the preview mode, when you execute below code as a bookmarklet, you can move | |
* slides next and previous by your handy smartphone. | |
* This code works with WebSocket application published in https://github.com/KensakuKOMATSU/ws-remocon. | |
* So, url for websocket server should be changed, depends on your environment. | |
*/ | |
(function(){ | |
var ws = new WebSocket('ws://localhost:3000'); |