2.0.1 • Published 6 years ago

skateboard v2.0.1

Weekly downloads
21
License
MIT
Repository
github
Last release
6 years ago

skateboard

Quickly create a stream from the browser to the server with engine.io

Use

npm install skateboard

// server.js
var skateboard = require('skateboard');
skateboard({
  dir: __dirname + '/public',          // default (optional)
  port : 8080,                         // default (optional)
  transports: ['polling', 'websocket'] // default (optional)
  // requestHandler: function(req, res) {} -- fallback request handler
}, function(stream) {
  var start = Date.now();
  stream.write('ping');

  stream.on('data', function() {
    console.log('latency:', (Date.now() - start) + 'ms');
  });
});

skateboard([wshref , fn])

  • wshref - optional cross domain skateboard to connect to
  • fn - optional connection handler. first argument is a duplex stream
<!-- public/index.html -->
<html>
<head>
  <script type="text/javascript" src="skateboard.min.js"></script>
</head>
<body>

<script type="text/javascript">
  skateboard().on('data', function(d) {
    this.write(d);
  });

  // or
  // skateboard(function(stream) {
  //   stream.on('data', function(d) {
  //     stream.write(d);
  //   });
  // });
  //
</script>

</body>
</html>

client events

  • connection - emitted on the first connection
  • disconnection - emitted whenever the connection disconnects
  • reconnection - emitted whenever a new connection is established

License

MIT

2.0.1

6 years ago

2.0.0

7 years ago

1.5.5

7 years ago

1.5.4

8 years ago

1.5.3

8 years ago

1.5.2

8 years ago

1.5.1

8 years ago

1.5.0

8 years ago

1.4.1

8 years ago

1.4.0

9 years ago

1.3.1

9 years ago

1.3.0

9 years ago

1.2.0

9 years ago

1.1.1

9 years ago

1.1.0

9 years ago

1.0.2

9 years ago

1.0.1

10 years ago

1.0.0

10 years ago

0.2.9

10 years ago

0.2.8

10 years ago

0.2.7

10 years ago

0.2.6

10 years ago

0.2.5

10 years ago

0.2.4

10 years ago

0.2.3

10 years ago

0.2.2

10 years ago

0.2.1

11 years ago

0.2.0

11 years ago

0.1.7

11 years ago

0.1.6

11 years ago

0.1.5

11 years ago

0.1.4

11 years ago

0.1.3

11 years ago

0.1.2

11 years ago

0.1.1

11 years ago

0.1.0

11 years ago

0.0.0

11 years ago