anchor.diff:              sockets.add(ws);
               // give 'em a name
               var name = 'Player #${sockets.indexOf(ws) + 1}';
  -            // send a welcome
  -            ws.add('Hello $name');
               // attach a listener to the websocket
               ws.listen( (msg){
  -              // remove any trailing whitespace
  -              msg = msg.trim();
  +              var blah = MessageParser.deserialize(msg);
   
  -              if (msg.startsWith('name:')) {
  -                var oldName = name;
  -                name = msg.substring(5).trim();
  -                print('$oldName would like to be called $name');
  -              } else {
  -                // print msg to server console
  -                print('$name says $msg');
  -                // distribute the msg to everybody
  -                sockets.forEach((socket){
  -                  if (socket != ws) {
  -                    socket.add('overheard ... $name says $msg');
  -                  }
  -                });
  +              switch(blah['command']) {
  +                case 'info':
  +                  print("${games.length} games and ${sockets.length} players");
  +                  ws.add("${games.length} games and ${sockets.length} players");
  +                  break;
  +                case 'name':
  +                  var oldName = name;
  +                  name = msg.substring(5).trim();
  +                  print("$oldName would like to be called $name");
  +                  ws.add("Okay, $name");
  +                  break;
  +                case 'join':
  +                  print("join or create game ${blah['argument']}");
  +                  ws.add("join or create game ${blah['argument']}");
  +                  break;
  +                case 'ready':
  +                  print("$name is ready");
  +                  ws.add("oh good");
  +                  break;
  +                default:
  +                  print("unsupported: $blah");
  +                  ws.add("unsupported: $blah");
                 }
  +
  +              /*
  +              // print msg to server console
  +              print('$name says $msg');
  +              // distribute the msg to everybody
  +              sockets.forEach((socket){
  +                if (socket != ws) {
  +                  socket.add('overheard ... $name says $msg');
  +                }
  +              });
  +              */
               });
             });
           }
  
positive.code: import 'dart:io';
  import 'dart:async';
  
  main() {
    runZoned(() {
  
negative.code:   },
    onError: (e) => print("An error occurred. $e"));
  }
  
  // commands:
  //  name [new_name]
  //  info   
  //  join [game_name]
  //  ready
  //  go [left, right, forward]
   
  class MessageParser {
    static String serialize() {
      return "";
    }
    static Map deserialize(String msg) {
      msg = msg.trim();
      var parts = msg.split(' ');
  
      return {
        "command": parts.first,
        "argument": msg.substring(parts.first.length).trim()
      };
    }
  }
  