title: Socket.io Error (socket.send is not a function)
body: <p>I'm trying out Websockets/Node.js/Socket.io/Express for the first time and I'm trying to create a simple chat program. Everything runs fine and I see both clients in my node termial. </p>
  
  <p>But when I try to execute my <code>socket.send()</code>, I get an error in Firefox (socket.send is not a function). It doesn't complain about <code>socket.connect()</code> so I know the socket.io.js is loaded.</p>
  
  <p>Here is my server code:</p>
  
  <pre><code>var sys = require('util');
  var express = require('express');
  var io = require('socket.io');
  
  var app = express.createServer();
  app.listen(8080);
  app.use(express.static(__dirname));
  
  app.get('/', function (req, res) {
      res.render('index.html', {
          title: 'Chat'
      });
  });
  
  var socket = io.listen(app);
  
  socket.on('connection', function (client) {
      client.on('message', function (message) {
          console.log("Message: " + JSON.stringify(data));
          socket.broadcast(message);
      });
      client.on('disconnect', function () {});
  });
  </code></pre>
  
  <p>My client code:</p>
  
  <pre><code>&lt;script src="http://localhost:8080/socket.io/socket.io.js"&gt;&lt;/script&gt;
  
  var socket = new io.Socket("http://localhost:8080");
  socket.connect();
  </code></pre>
  
  <p>Then I do some code to get the chat message and send it.</p>
  
  <pre><code>socket.send(JSON.stringify(values));
  </code></pre>