Hi George,
I got the following error on the hour13 example 4 of your book, I put it as the following, who define the callback function?
Thanks,
Y.H. Chang
C:\1yh\download\bk\JavaScript\node_js_Redis\tysf_nodejs\hour13\example04>node ap
p.js
info - socket.io started
debug - served static content /socket.io.js
debug - client authorized
info - handshake authorized 18904434431555541341
debug - setting request GET /socket.io/1/websocket/18904434431555541341
debug - set heartbeat interval for client 18904434431555541341
debug - client authorized for
debug - websocket writing 1::
C:\1yh\download\bk\JavaScript\node_js_Redis\tysf_nodejs\hour13\example04\app.js:
16
callback(true);
^
TypeError: undefined is not a function
at Socket. (C:\1yh\download\bk\JavaScript\node_js_Redis\tysf_node
js\hour13\example04\app.js:16:7)
at Socket.EventEmitter.emit as $emit
at SocketNamespace.handlePacket (C:\1yh\download\bk\JavaScript\node_js_Redis
\tysf_nodejs\hour13\example04\node_modules\socket.io\lib\namespace.js:335:22)
at Manager.onClientMessage (C:\1yh\download\bk\JavaScript\node_js_Redis\tysf
_nodejs\hour13\example04\node_modules\socket.io\lib\manager.js:459:38)
at WebSocket.Transport.onMessage (C:\1yh\download\bk\JavaScript\node_js_Redi
s\tysf_nodejs\hour13\example04\node_modules\socket.io\lib\transport.js:387:20)
at Parser. (C:\1yh\download\bk\JavaScript\node_js_Redis\tysf_node
js\hour13\example04\node_modules\socket.io\lib\transports\websocket\hybi-16.js:4
0:10)
at Parser.EventEmitter.emit (events.js:93:17)
at opcodeHandlers.1.finish (C:\1yh\download\bk\JavaScript\node_js_Redis\tysf
_nodejs\hour13\example04\node_modules\socket.io\lib\transports\websocket\hybi-16
.js:286:16)
at Parser.opcodeHandlers.1.expectData [as expectHandler](C:1yhdownloadbk
JavaScriptnode_js_Redistysf_nodejshour13example04node_modulessocket.ioli
btransportswebsockethybi-16.js:297:15)
at Parser.add (C:\1yh\download\bk\JavaScript\node_js_Redis\tysf_nodejs\hour1
3\example04\node_modules\socket.io\lib\transports\websocket\hybi-16.js:464:24)
C:\1yh\download\bk\JavaScript\node_js_Redis\tysf_nodejs\hour13\example04>
The callback is sent by the client here
https://github.com/shapeshed/nodejsbook.io.examples/blob/master/hour13/example07/views/layout.jade#L51
Are you using the code examples from github? If so could you let me know what version of node you are running using node -v?
Hi George,
I am using code sample on github. It is hour13 example4 on windows 7 with
node.js v0.8.12.
The major error is function (data, callback), the callback is not defined
as the following.
Thanks,
Y.H. Chang
C:\1yh\download\bk\JavaScript\node_js_Redis\tysf_nodejs\hour13\example04>node
ap
p.js
info - socket.io started
debug - served static content /socket.io.js
debug - client authorized
info - handshake authorized 18904434431555541341
debug - setting request GET /socket.io/1/websocket/18904434431555541341
debug - set heartbeat interval for client 18904434431555541341
debug - client authorized for
debug - websocket writing 1::
C:\1yh\download\bk\JavaScript\node_js_Redis\tysf_nodejs\hour13\example04\app.js:
16
callback(true);
^
TypeError: undefined is not a function
at Socket.
(C:\1yh\download\bk\JavaScript\node_js_Redis\tysf_node
js\hour13\example04\app.js:16:7)
at Socket.EventEmitter.emit as $emit
at SocketNamespace.handlePacket
(C:\1yh\download\bk\JavaScript\node_js_Redis
\tysf_nodejs\hour13\example04\node_modules\socket.io
\lib\namespace.js:335:22)
at Manager.onClientMessage
(C:\1yh\download\bk\JavaScript\node_js_Redis\tysf
_nodejs\hour13\example04\node_modules\socket.io\lib\manager.js:459:38)
at WebSocket.Transport.onMessage
(C:\1yh\download\bk\JavaScript\node_js_Redi
s\tysf_nodejs\hour13\example04\node_modules\socket.io
\lib\transport.js:387:20)
at Parser.
(C:\1yh\download\bk\JavaScript\node_js_Redis\tysf_node
js\hour13\example04\node_modules\socket.io
\lib\transports\websocket\hybi-16.js:4
0:10)
at Parser.EventEmitter.emit (events.js:93:17)
at opcodeHandlers.1.finish
(C:\1yh\download\bk\JavaScript\node_js_Redis\tysf
_nodejs\hour13\example04\node_modules\socket.io
\lib\transports\websocket\hybi-16
.js:286:16)
at Parser.opcodeHandlers.1.expectData [as expectHandler](C:1yhdownloadbk
JavaScriptnode_js_Redistysf_nodejshour13example04node_modules
socket.ioli
btransportswebsockethybi-16.js:297:15)
at Parser.add
(C:\1yh\download\bk\JavaScript\node_js_Redis\tysf_nodejs\hour1
3\example04\node_modules\socket.io
\lib\transports\websocket\hybi-16.js:464:24)
On Thu, Nov 8, 2012 at 5:19 AM, George Ornbo [email protected]:
The callback is sent by the client here
https://github.com/shapeshed/nodejsbook.io.examples/blob/master/hour13/example07/views/layout.jade#L51
Are you using the code examples from github? If so could you let me know
what version of node you are running using node -v?
—
Reply to this email directly or view it on GitHubhttps://github.com/shapeshed/nodejsbook.io.examples/issues/2#issuecomment-10187482.
Same error happening to me here