Created
September 18, 2011 09:58
-
-
Save Azerothian/1224934 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- Serverside -- | |
nowjs.on('connect', function() { | |
util.log('Sending Message?'); | |
this.now.receiveMessage('SERVER', 'Welcome to NowJS.'); | |
}); | |
everyone.now.distributeMessage = function(message) { | |
everyone.now.receiveMessage(this.now.name, message); | |
}; | |
-- client side -- | |
$(document).ready(function() { | |
now.receiveMessage = function(name, message) { | |
$("#messages").append("<br>" + name + ": " + message); | |
}; | |
$("#send-button").click(function() { | |
now.distributeMessage($("#text-input").val()); | |
$("#text-input").val(""); | |
}); | |
now.name = prompt("What's your name?", ""); | |
}); | |
-- Server Error Message -- | |
info - handshake authorized 9386518251885899002 | |
18 Sep 19:52:12 - Sending Message? | |
{ stack: [Getter/Setter], | |
arguments: [ 'receiveMessage', {} ], | |
type: 'property_not_function', | |
message: [Getter/Setter] } | |
TypeError: Property 'receiveMessage' of object #<Object> is not a function | |
at [object Object].<anonymous> (/root/www/app.js:51:11) | |
at [object Object].<anonymous> (events.js:81:20) | |
at Socket.rdHandler (/root/www/node_modules/now/lib/user.js:125:20) | |
at Socket.$emit (events.js:61:17) | |
at SocketNamespace.handlePacket (/root/www/node_modules/now/node_modules/socket.io/lib/namespace.js:331:20) | |
at Manager.onClientMessage (/root/www/node_modules/now/node_modules/socket.io/lib/manager.js:436:38) | |
at WebSocket.onMessage (/root/www/node_modules/now/node_modules/socket.io/lib/transport.js:387:20) | |
at Parser.<anonymous> (/root/www/node_modules/now/node_modules/socket.io/lib/transports/websocket/hybi-07-12.js:38:10) | |
at Parser.emit (events.js:64:17) | |
at /root/www/node_modules/now/node_modules/socket.io/lib/transports/websocket/hybi-07-12.js:209:16 | |
info - transport end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment