Below the event binding on socket.io
worked correctly,
io = require('socket.io')()
io.on 'connection', (socket) ->
console.log socket.id
io.listen 3000
Then tried to convert socket.io event
to Bacon EventStream
,
Bacon = require('baconjs').Bacon
io = require('socket.io')()
connections = Bacon.fromEventTarget io, 'connection'
connections.onValue (socket) ->
console.log socket.id
io.listen 3000
Why did it fail below?
TypeError: Object connection has no method 'on'
Aucun commentaire:
Enregistrer un commentaire