javascript - Deprecated io.use() and io.get() with socket.io -


i'm writing game of tutorial :

http://portal.bluejack.binus.ac.id/tutorials/creatingmultiplayerwebgameusingwebsocketnodejsandsocketio-part1-serverside

and have problem deprecated socket.io.

i have read guide : http://socket.io/docs/migrating-from-0-9/

but don't know how can change it...

i have problem socket.set() , socket.get().

for example :

var idx = playerin.push(slot);  socket.set('playerslot', idx-1); 

or

socket.get('playerslot', function(err, idx){         var slot = playerin[idx];          socket.emit('serverplayerstatus', slot);     }); 

how can change it?

thanks guys :)

btw error :

missing error handler on socket. typeerror: undefined not function @ socket. (/home/adelante/tutorial/app.js:87:16) @ socket.emit (events.js:107:17) @ socket.onevent (/home/adelante/tutorial/node_modules/socket.io/lib/socket.js:330:8) @ socket.onpacket (/home/adelante/tutorial/node_modules/socket.io/lib/socket.js:290:12) @ client.ondecoded (/home/adelante/tutorial/node_modules/socket.io/lib/client.js:193:14) @ decoder.emitter.emit (/home/adelante/tutorial/node_modules/socket.io/node_modules/socket.io-parser/node_modules/component-emitter/index.js:134:20) @ decoder.add (/home/adelante/tutorial/node_modules/socket.io/node_modules/socket.io-parser/index.js:247:12) @ client.ondata (/home/adelante/tutorial/node_modules/socket.io/lib/client.js:175:18) @ socket.emit (events.js:107:17) @ socket.onpacket (/home/adelante/tutorial/node_modules/socket.io/node_modules/engine.io/lib/socket.js:99:14)


Comments

Popular posts from this blog

javascript - gulp-nodemon - nodejs restart after file change - Error: listen EADDRINUSE events.js:85 -

Fatal Python error: Py_Initialize: unable to load the file system codec. ImportError: No module named 'encodings' -

javascript - oscilloscope of speaker input stops rendering after a few seconds -