Skip to content

Commit

Permalink
Added webworker
Browse files Browse the repository at this point in the history
  • Loading branch information
rauchg committed Oct 18, 2011
1 parent 72a0503 commit 7c2dbf3
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions test/worker.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
importScripts('/socket.io/socket.io.js');

self.onmessage = function (ev) {
var url = ev.data
, socket = io.connect(url);

socket.on('done', function () {
self.postMessage('done!');
});

socket.on('connect_failed', function () {
self.postMessage('connect failed');
});

socket.on('error', function () {
self.postMessage('error');
});

socket.send('woot');
}

0 comments on commit 7c2dbf3

Please sign in to comment.