Permalink
Browse files

readme

  • Loading branch information...
1 parent 7d63aa3 commit a4a4a7c82c25768f6a871291627475b2ac1ed6cd @dominictarr committed May 31, 2012
Showing with 55 additions and 0 deletions.
  1. +55 −0 readme.markdown
View
@@ -0,0 +1,55 @@
+#skates
+
+opinions:
+
+ * WebSocket based apps needs to be on ecosystem, like connect, express.
+ * WebSocket other websocket frameworks are too monolithic.
+ * make your life easy: use a module bundler on the client
+
+this is all you need:
+
+``` js
+//client.js
+var emitter = require('skates')()
+
+setInterval(function () {
+ emitter.emit('ping', Date.now())
+}, 1e3)
+emitter.on('pong', function (time) {
+ console.log('latency:', time)
+})
+
+```
+
+and this:
+
+``` js
+//server.js
+var skates = require('skates')
+var connect = require('connect')
+var app = skates.createServer()
+ .use(connect.static('public')
+ .on('connection', function (emitter) {
+ emitter.on('ping', function (time) {
+ emitter.emit('pong', Date.now() - time)
+ })
+
+ })
+ .listen(3000)
+```
+
+too easy.
+
+oh, yeah.
+``` html
+<!-- public/index.html -->
+<!doctype html>
+<html>
+ <head>
+ <script src=/browserify.js></script>
+ </head>
+</html>
+```
+
+then `node server & google-chrome localhost:3000`
+

0 comments on commit a4a4a7c

Please sign in to comment.