Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
  • Sep 10 2018 02:41
    Naiba01 commented #1157
  • Sep 05 2018 18:37
    govarthananve commented #1080
  • Sep 05 2018 17:12
    carloquilala opened #1349
  • Aug 07 2018 11:42
    carloquilala edited #1348
  • Aug 07 2018 11:14
    carloquilala opened #1348
  • Jul 31 2018 06:46
    zaoansijia commented #1347
  • Jul 13 2018 01:45
    gapsaras commented #842
  • Jul 12 2018 10:08
    grootendorste commented #930
  • Jul 02 2018 15:06
    aozfen commented #1092
  • Jun 25 2018 17:25
    olliecaine27 closed #1268
  • Jun 03 2018 17:30
    olliecaine27 synchronize #1268
  • Jun 03 2018 17:16
    olliecaine27 synchronize #1268
  • May 22 2018 05:14
    ishan123456789 commented #1220
  • May 19 2018 08:38
    MirShi opened #1347
  • May 14 2018 19:53
    samanthi22 closed #1346
  • May 14 2018 19:53
    samanthi22 commented #1346
  • May 05 2018 17:33
    samanthi22 opened #1346
  • Apr 22 2018 09:28
    m-ketan closed #1319
  • Apr 20 2018 00:40
    matthew-dean commented #658
  • Apr 02 2018 12:36
    AndrewSavetchuk commented #1080
Mike DeVita
@mikedevita
so its automatic on server side
client side just needs to subscribe to the appropriate channel
joshuaandrewhoffman
@joshuaandrewhoffman
Hmm okay I might be missing something then. Haven't used sails
Mike DeVita
@mikedevita
sailsjs just provides a helper basically that whenever a model changes it pushes a message to all subscribed clients
joshuaandrewhoffman
@joshuaandrewhoffman
If it were pure socket-io or socketio-redux my approach is what I'd use. Sails sounds like it makes stuff work a little more like firebase or meteor?
Mike DeVita
@mikedevita
kind of?
joshuaandrewhoffman
@joshuaandrewhoffman
Okay
Mike DeVita
@mikedevita
sails doesnt care where/how the update comes from it could be via http POST to the api
or via a socket.io connection
joshuaandrewhoffman
@joshuaandrewhoffman
Ooh that's kinda nice
Okay so your only question is just one of organization on the server side? Like where should the code live?
Mike DeVita
@mikedevita
client side
where would you put the things like
socket.on('server-update', function(server) {
  // do something with the updated server info
 // maybe dispatch a thunk action?
});
joshuaandrewhoffman
@joshuaandrewhoffman
I think that package I mentioned has it right about how to do this. I. Had the name wrong though, it's: https://www.npmjs.com/package/redux-socket.io
Mike DeVita
@mikedevita

right now i have things like ...

socket.on('connected', function () {
    // dispatch(socket.connected(socketId)
   // console.log('connected to backend')
});
socket.on('disconnected', function () {
    // dispatch(socket.connected(socketId)
   // console.log('connected to backend')
});

in my store/socket.js file and i call socket.connect() in my appcontainer.js onMount()

joshuaandrewhoffman
@joshuaandrewhoffman
it might conflict with sails on the client->server aspect but you could use the same principle
Mike DeVita
@mikedevita
sails just adds http capable wrappers into socket.io so i can do something like io.sails.get|post|put|delete()
joshuaandrewhoffman
@joshuaandrewhoffman
Might be ok then
I really like what redux-socketio
Mike DeVita
@mikedevita
ill check it out
joshuaandrewhoffman
@joshuaandrewhoffman
Prescribes*
Mike DeVita
@mikedevita
which person is it made by? link?
there are several of them
and do you have any code samples i can peek at?
joshuaandrewhoffman
@joshuaandrewhoffman
I linked the npm, pretty sure that's the right one. I'm pre coffee and on mobile atm so buyer beware :P
Mike DeVita
@mikedevita
ahh i missed that
thats the one i was looking at lol
so i take it your action.type is the "channel"
or is the channel "action"
joshuaandrewhoffman
@joshuaandrewhoffman
Code isn't in front of me but the gist is just action handlers like [server/state_update]
Mike DeVita
@mikedevita
ok
joshuaandrewhoffman
@joshuaandrewhoffman
Sorry you lost me w channels
Mike DeVita
@mikedevita
socket.io has a concept of channels or rooms..
e.g. socket.emit('channelname', { // some data })
joshuaandrewhoffman
@joshuaandrewhoffman
Ohhh yeah
So that's what I was saying I got stuck on and couldn't solve so rolled my own channel tracking
Mike DeVita
@mikedevita
ok
i have a channel for each server basically how it works out, by default.. and a channel for each server agent thats used to broadcast stats and startup/shutdown
joshuaandrewhoffman
@joshuaandrewhoffman
Similar to what you described I think. This user/socket is in this place
The only difference is I'm emitting to that user and everyone else there by hand
Which isn't super maintainable and something that won't scale so I gotta fix it
Definitely ambiguous implementation wise whether you send your data to all users always when something changes or only send things that are relevant to the page they're on. It may very well be case by case
Mike DeVita
@mikedevita
i want all things updated
joshuaandrewhoffman
@joshuaandrewhoffman
Sorry to vanish on you Mike, got a ton going on today. Hopefully I helped a bit. If you need to chat more about this I can late this evening or Sunday
Mike DeVita
@mikedevita
you did help a lot i havent had a chance to dig into it more yet, my home server lab is in pieces and im waiting on the UPS guy to get here with some gear so i can put it back together...
Jishnu Viswanath
@neolivz
does any one know good skelton/bootstrap project with Typescript and Koa?
Sorry wrong thread/group
jet oneza
@jetoneza
I really like this kit. We use it in production.
aditya shanker tagirisa
@adityashankert
Me too we R going to move to production next week