Hi,
I'm trying to put a socket.io-client instance inside a mst definition. I want to make the socket.io buffered/data stream goes reactive, is it possible to do so? The reason to do this is I only want one socket.io-client instance alive between navigations.
Some options I'm thinking of:
Sounds like a job for: https://github.com/mobxjs/mobx-state-tree#modelvolatile
@skellock I'll give it a try, thank you.
recently also asked on spectrum. they ended up using the dependency injection to do so and did setup an action on the channel. something like that:
.actions(self => ({
someAction(param, param2) {
...
},
afterCreate() {
self.channel = getEnv(self).socket.channel("channelId")
channel.on = self.someAction;
}
}))
Most helpful comment
recently also asked on spectrum. they ended up using the dependency injection to do so and did setup an action on the channel. something like that: