Fork me on GitHub
#immutant
<
2016-08-17
>
timgilbert15:08:39

Hi all. I'm messing around with websockets some, and I'm wondering what sort of approach people generally take in order to keep track of which users are connected to which sockets

timgilbert15:08:31

The obvious thing to me would be just to keep an atom and update it with {:user-1 websocket-ch} whenever someone is successfully authenticated

timgilbert15:08:32

But I'm wondering if there's something built in to immutant that might give me a less "maintain your own atom" kind of interface to it, since immutant/undertow need to maintain a pool of websockets anyways

timgilbert15:08:12

Parenthetically, the links to the API docs for websockets and the feature demo example for websockets are both broken on this page: http://immutant.org/tutorials/web/

tcrawley15:08:51

@timgilbert: we don't really provide anything for tracking state like that, other than you putting it into an infinispan cache instead of an atom, which would really only have advantages if you were in a cluster

tcrawley15:08:09

sente gives you that tracking for free though - have you looked at it?

tcrawley15:08:59

thanks for the report on broken links in that tutorial, but I doubt we'll fix them, since that's old, and we recommend using the guides now: http://immutant.org/documentation/current/apidoc/guide-web.html

jcrossley315:08:33

@timgilbert: how might we better phrase the text in that box at the top of that page to get you to click on the link to the latest docs?

timgilbert15:08:43

Oops, I guess I would have had to have read it in order to evaluate the phrasing 😉

timgilbert15:08:16

I'm pretty sure I got there via google search for "immutant websockets" or something similar

timgilbert15:08:31

Sorry, PEBKAC

timgilbert15:08:21

I will take a look at sente, thanks for the pointer. I had sort of assumed it was just a front-end thing, I think

tcrawley15:08:53

it's front and back end, and handles a lot of the complexity of managing async connections for you

timgilbert15:08:18

Cool, might be just what I'm looking for