Permalink
Browse files

Added webworker

  • Loading branch information...
1 parent 72a0503 commit 7c2dbf3ba580799baa0513c6f7384e64743897bc @rauchg rauchg committed Oct 18, 2011
Showing with 20 additions and 0 deletions.
  1. +20 −0 test/worker.js
View
20 test/worker.js
@@ -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.