Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
tree: aef675d4a9
Fetching contributors…

Cannot retrieve contributors at this time

20 lines (16 sloc) 0.491 kb
#import('dart:html');
#import('dart:json');
void main() {
CanvasElement canvas = document.query('#bb');
CanvasRenderingContext2D ctx = canvas.getContext("2d");
WebSocket ws_recv = new WebSocket("ws://" + window.location.host + "/recvdata");
ws_recv.on.message.add((event) {
print("received data: ${event.data}");
List<int> coords = JSON.parse(event.data);
ctx.beginPath();
for (int i=0;i<coords.length;i+=2) {
ctx.lineTo(coords[i], coords[i+1]);
}
ctx.stroke();
});
}
Jump to Line
Something went wrong with that request. Please try again.