Fork me on GitHub
#fulcro
<
2020-04-22
>
folcon00:04:39

I’m not sure I can pickup a new project right now @clojure388, sorry. However if you want to do something similar to what @thomas was talking about re, doing some learning together etc would be happy to do that… Also happy to sit down and go over stuff if you just want someone to bounce ideas off of, I’ve built a few things myself =)… (Just not with Fulcro yet) Not sure about timezone overlap, I’m just about to head to bed myself…

folcon00:04:05

One option I have been thinking of is this: http://www.fulcrologic.com/products-services, specifically Fulcro Training being offered, not sure if this is old or not, but perhaps we could band together to arrange some classes? Happy to be a student myself if others are interested =)… I’m not sure what Tony’s position is on this stuff? Is it helpful or a distraction?

tony.kay18:04:46

Well, my position is that if there is an organized need for paid training I will certainly consider it. I do think if you avail yourself of the existing materials you can get quite far without paying anything (but your own time and effort).

folcon16:04:16

For the moment we’ve decided to spend a week working on it and reconvene next Wednesday, at that point we’ll see how we’ve progressed and decide from there =)…

thomas11:04:04

@clojure388 I wasn't exactly looking for a side project, but not against it either by default. I was more thinking trying things out and learning together (and helping each other understand Fulcro better, as that is something I struggle with). That said I am also happy to bounce of ideas etc. and discuss options. What is you time zone?

folcon11:04:35

Would it be worthwhile to arrange a quick call at some point? Can quickly discuss stuff =)…

grischoun12:04:14

@clojure388 @folcon @thomas I might be interested by a side project or learning together.

folcon12:04:17

We’ve got a discussion going, want join in?

holyjak18:04:56

Hi! Has anybody tried to integrate Fulcro with server-side events? It might be a simpler solution for my need of pushing updates to the client than websockets...

folcon20:04:01

I've got websockets working really easily? Not sure what the overhead was for sse? (Not sure the reason you're asking is because you think that setup is difficult =)…)

holyjak20:04:30

Eg SSE share the same http stuff so I don't need a separate session management, track clients etc. But good to hear that WS are simple! BTW, do you know what happens on the client when the server pushes data over WS? I know how fulcro remotes can be called but how does the remote call you?

folcon21:04:37

You can access the websocket state on the server, there’s a list of connected clients who it knows about, you can just map the websocket client-id to your user session and then message the correct client…

holyjak06:04:28

Thank, I know how I can push from the server to the client but what happens on the client? Does the data magically appear in the DB or is there some callback-mutation magically associated with the WS remote that gets called to handle the incoming data?

folcon11:04:00

I’ve not used the subscribe feature directly on fulcro yet, but have fiddled about with the websockets themselves (using a custom remote etc) and that just put the values into the app-db. It’s just using sente under the hood, so I’d be surprised if this was too problematic to work with. I’m planning on doing so over this weekend, so happy to update you once I’ve done so…

nfedyashev14:04:13

Hi @folcon I was interested in using your fulcro template for a new project https://github.com/Folcon/fulcro-template because it has some updated dependencies+heroku+websocket The only issue that I currently have is that after executing (shadow/repl :main) emacs/cider looses the connection to that repl(it becomes like standalone, no integration with emacs). I was reviewing the latest commits and couldn't find what might have caused it. Perhaps you may have an idea? I don't have such issue with (old/outdated https://github.com/fulcrologic/fulcro-template )

folcon14:04:13

2 secs, let me check, I’ll need a little time it seems, github has currently degraded service… @: Hmm, with regards to losing connection, you are still seeing the repl swap over without my changes? Are you getting any error messages anywhere?

nfedyashev14:04:53

no error messages, it just "removes" the repl buffer from the current session, so I cant send any more commands from emacs. But it is still listed as a process in emacs, and I can switch to it by choosing another buffer

nfedyashev14:04:24

I can even execute stuff like (js/alert "foo") from that detached repl

nfedyashev14:04:26

Do you think this could be related to - :session true +:session {} in  https://github.com/Folcon/fulcro-template/commit/65939cc48f667b565c83942071567c842a8170e8#diff-e2a5ad8c0d5071a82238dc5824513ca7 ? The rest seems like incremental updates

nfedyashev14:04:39

I was thinking about applying your commits one by one, to figure out the one that broke nrepl for me but that's not very easy/fast 🙂 I'll let you know if I find it

folcon15:04:23

Sure, I doubt that’s the issue, the :session change exists to make websocket sessions shareable, basically if that config value is set to true, you can’t then customise session storage…

folcon15:04:59

Sorry, it’s hard for me to debug this as I normally use cursive 😊

mdhaney15:04:51

Regarding how to process events pushed from the server over websockets - when you create the websocket remote for the client, you can add a :push-handler key to the options map. This should be set to your function to handle server push events. The function takes a single arg, which is a vector of [topic msg]. A typical approach would be to setup a multimethod dispatched on the topic. Within your handler(s) you would run mutations to handle the state update, just as you would from other parts of the client. A key point here is the shape of your data compared to what you normally would receive from a load, etc. There are a few approaches you can use. One is to push data in the same shape as you use for loads, then on the client you can do a merge-component using the same components used for loads. Another related technique is to, just as you can create components just for their queries when loading, do the same thing and create components that mirror the shape of your push data and only use them with merge-component for processing push data. And finally, an option that’s sometimes useful is to have your push messages only contain the id(s) of entities that need to be updated, and the client uses this information to then issue a load of the data to be refreshed.

folcon16:04:15

@ Is that documented somewhere? I’ll be wanting to play with that this weekend, so having something I can look at if I need it would be great =)…

mdhaney16:04:59

It’s documented in the doc string for the remote. I could have swore it used to be in the Readme, but not anymore.

folcon00:04:16

@ as I needed to do it anyway, I’ve done some digging and distilled ->https://folcon.github.io/post/2020-04-26-Websocket-Subscriptions-in-Fulcro/. Let me know if you have questions =)…

holyjak09:04:12

awesome, thanks!

holyjak12:04:32

@ thanks for the pointer!