i have this code:

var server = require('http').createServer(function(req, res){
  res.end(html);
});
server.listen(process.env.VCAP_APP_PORT || 9080);

var nowjs = require("now");
var everyone = nowjs.initialize(server);

everyone.now.distributeMessage = function(message){
  console.log('User '+this.now.name+' added message ' +message);
  everyone.now.receiveMessage(this.now.name, message);
};

and am using the now.js from https://github.com/jameskeane/now

when i run

% node app.js and then from my client i have this code:

....

  <script type="text/javascript" 
src="http://127.0.0.1:9080/nowjs/now.js";></script>
  <script type="text/javascript">
    $(document).ready(function(){
        now.receiveMessage = function(name, message){
        $("#messages").append('<br />' + '<a href="${path}">' + name + 
'</a>' + ': ' + message);
        }
        $("#send-button").click(function(){
        now.distributeMessage($("#text-input").val());
        $("#text-input").val("");
        });
      now.name = "${name}";
    });
  </script>
</body>

this works fine and the mesages are sent, but i get this console errors

[ReferenceError: html is not defined]
ReferenceError: html is not defined
    at Server.<anonymous> 
(/Users/khinester/Sandboxes/zeitgeist/zchat/app.js:2:11)
    at Server.handleResponse 
(/Users/khinester/Sandboxes/zeitgeist/zchat/node_modules/now/lib/fileServer.js:43:31)
    at Manager.handleRequest 
(/Users/khinester/Sandboxes/zeitgeist/zchat/node_modules/now/node_modules/socket.io/lib/manager.js:565:28)
    at Server.<anonymous> 
(/Users/khinester/Sandboxes/zeitgeist/zchat/node_modules/now/node_modules/socket.io/lib/manager.js:119:10)
    at Server.EventEmitter.emit (events.js:91:17)
    at HTTPParser.parser.onIncoming (http.js:1793:12)
    at HTTPParser.parserOnHeadersComplete [as onHeadersComplete] 
(http.js:111:23)
    at Socket.socket.ondata (http.js:1690:22)
    at TCP.onread (net.js:402:27)

what am i missing?

-- 
Job Board: http://jobs.nodejs.org/
Posting guidelines: 
https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
You received this message because you are subscribed to the Google
Groups "nodejs" group.
To post to this group, send email to nodejs@googlegroups.com
To unsubscribe from this group, send email to
nodejs+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/nodejs?hl=en?hl=en

Reply via email to