Socket.io change feed help (performance)
Nobody has claimed this yet.
- Dominant language
- CSS
- Stars
- 118
- Forks
- 161
- PR merge metrics
- No merged PRs in 30d
Description
Hello, im setting up a change feed that pushes to a socket io connection.
Im worried that setting up a new change feed for each io connection is gonna be a bit intensive.
Can rethink handle 100-1000 change feeds OK ?
Ill post my code below and any advice or feedback would be amazing, this is my first time using change feeds.
Also so i need to 'unsubscribe' from the change feed ?
Here is my current code :
startSocket() {
this.io.sockets.on('connection', socket => {
console.log(' %s sockets connected', this.io.engine.clientsCount)
socket.on('new_connection', target => {
rethink
.table(target)
.changes({ includeInitial: true })
.run((err, cursor) => {
cursor.each((err, item) => {
socket.emit(target, item.new_val)
})
})
})
socket.on('disconnect', function() {
console.log('disconnect: ', socket.id)
})
})
}
Thanks
Luke
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
The only entry point shown is startSocket(), including the new_connection and disconnect handlers; begin by reviewing the changefeed cursor lifecycle alongside the Socket.io connection lifecycle. Determine whether per-socket feeds and cleanup are supported for this setup, then document a confirmed recommendation and clear completion criteria.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript
- Domain
- backend, databases, networking
- Issue type
- Documentation
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 20/100