Skip to content
This repository

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

file 18 lines (16 sloc) 0.491 kb
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
#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();
});
}
Something went wrong with that request. Please try again.