peer.html 1022 B

1234567891011121314151617181920212223242526272829303132333435363738
  1. <!DOCTYPE HTML>
  2. <html lang="en">
  3. <head>
  4. <title>Peer Test</title>
  5. <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
  6. <meta http-equiv="Content-Language" content="en-us">
  7. <meta name="description" content="">
  8. <meta name="keywords" content="">
  9. <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.6.2/jquery.min.js"></script>
  10. <script type="text/javascript" src="/peer.js"></script>
  11. <script>
  12. $(document).ready(function() {
  13. originator = new Peer('michelle', { key: 'r6l1dggn5hebqpvi', host: 'localhost', port: '9000', debug: true });
  14. originator.on('open', function(id) {
  15. console.log(id);
  16. });
  17. originator.on('error', function(msg) {
  18. console.log(msg);
  19. });
  20. originator.on('connection', function(connection) {
  21. x = connection;
  22. console.log('connection');
  23. connection.on('data', function(data) {
  24. console.log(data);
  25. });
  26. connection.send('What is going on?');
  27. });
  28. });
  29. </script>
  30. </head>
  31. <body>
  32. This is a P2P peer.
  33. </body>
  34. </html>