2 ms·
I'm working on the exact opposite migration at the moment :) (Most of our stack is Go, but we use the excellent Faye library written in Node) The Node code is r
by tschellenbach 9y ago
I'm working on the exact opposite migration at the moment :)
(Most of our stack is Go, but we use the excellent Faye library written in Node)
The Node code is really well done. https://faye.jcoglan.com/ https://faye.jcoglan.com/
Nothing wrong with the Node codebase. In our case we just had to add a lot of business logic. I could have done that in Node (we did for a long time), but I decided that with the latest set of changes we'd bring this component in line with the rest of our infrastructure.
It's hard to know without the code, but the author seems to be doing a few things wrong:
1. You only need a few channels, not N. Maybe 4-5 is enough.
2. In terms of goroutines you only need as many as are actively communicating with your server. So creating a new connection creates a goroutine, sending a message to a channel creates a goroutine etc.
3. You need something like Redis if you want to support multiple nodes
For inspiration check out this awesome project:
https://github.com/faye/faye-redis-node https://github.com/faye/faye-redis-node
This will perform well in Node and even better in Go.