go-socket.io
go-socket.io copied to clipboard
Scale up
The Node.JS version of socket.io has a concept of a store, to keep track of connections: this allows it to work in a load-balanced setup.
More info here: https://github.com/Automattic/socket.io/wiki/Configuring-Socket.IO#server
Is something similar to this possible with the Go version?
File the issue too soon (and apparently in the wrong repository).
If I'm not mistaken, serverSessions
in https://github.com/googollee/go-engine.io/blob/master/sessions.go takes care of this. This would be the equivalent of MemoryStore
.
Would you be open to exposing this interface in the API so that we can plug different implementations (e.g. a Redis store)?
I'm happy to help with this, once I have a bit more spare time.
How about a interface like ServerSessions
or named as something else, and can be set out of library? If not set, it will act as current serverSessions
?
Yes, exactly that, an interface with a couple of methods, which can be set but which falls back to the default in-memory serverSessions
.
It would mean that there is no change required for current users, but makes it possible to scale out.
Please check the latest code, I add support SetSessionManager
. Could you check if it works?
Oh wow, thanks! I'll have a look at it, in a week or two. We're currently in the process of launching a new product some time is a bit limited.
Will report back on our experiences once I get round to it. On 1 Feb 2015 05:52, "Googol Lee" [email protected] wrote:
Please check the latest code, I add support SetSessionManager. Could you check if it works?
— Reply to this email directly or view it on GitHub https://github.com/googollee/go-socket.io/issues/64#issuecomment-72351628 .
@rubenv How are you storing the session object? And how are you reconstructing it when retrieving it?
Right, forgot about this one.
I'm not sure you can. We had a good look at it, felt that this was going to be a ton of work and realised we didn't need all of this. In the end we opted not to use socket.io and build something simpler/more specialised: https://github.com/rubenv/broadcaster
As for session support here: the objects inside a session aren't really serialisable, so for now I don't think you can.
Then I wonder what the docs mean when they say a session manager can help you load balance, I'd love to see an example.
No. I'm sure currently no feature like this. And I still wonder what's the code like about load balance.