Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
JavaScript
branch: master

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.
lib
public
.gitignore
Procfile
README.md
package.json
server.js

README.md

PocketSockets

How it works:

<html>
  <head>
    <title>Socket Demo</title>
    <script src="//sockets.chrisrhoden.com/desktop.js"></script>
    <script>
      (function () {
        var ps = com.chrisrhoden.sockets;

        ps.connect(function (socket) {
          $('#qr').attr('src', socket.qr);
          socket.on('join', function (data) {
            $('#qr-container').hide();
          });

          socket.on('data', function (data) {
            console.log(data);
          });
        });

      })();
    </script>
  </head>
  <body>
    <div id="qr-container">
      Scan this: <img id="qr" />
    </div>
  </body>
</html>
<html>
  <head>
  <title>Socket Demo (mobile page)</title>
  <script src="//sockets.chrisrhoden.com/mobile.js"></script>
  <script>
    (function () {
      var ps = com.chrisrhoden.sockets;

      ps.connect(function (socket) {
        $(form).submit(function () {
          var val = $('#text').val();
          $('#text').val('');

          socket.emit('data', {text:text});
        });
      });

    })();
  </script>
  </head>
  <body>
    <form>
    <input type='text' id='text' /><input type='submit' />
    </form>
  </body>
</html>
Something went wrong with that request. Please try again.