Fork me on GitHub
#fulcro
<
2018-08-09
>
currentoor20:08:25

for my project i need to build a device that can be installed on-site (at carwashes) and it can control mechanical equipment, i’m using a raspberry pi with nodejs. i wanted to take advantage of all the fulcro websocket features (single queue, acknowledgements, mutations, app-state etc.) how should i go about this?

currentoor20:08:53

i was thinking i implement the FulcroApplication protocol to make a headless nodejs client

tony.kay20:08:13

ah, you mean you want to write the node stuff in Fulcro

tony.kay20:08:48

thinking…

currentoor20:08:55

except without components or UI

tony.kay20:08:14

isn’t it a server in that case?

tony.kay20:08:19

you just want to sent it mutations

tony.kay20:08:44

and run queries on it to see status

currentoor20:08:17

but none of the clj code will work on it

tony.kay20:08:28

so that sounds like a pretty simple websocket connection with transit and a parser

currentoor20:08:49

but how will that give the request queue?

tony.kay20:08:20

the request queue lives on the machine that is sending the requests to it

tony.kay20:08:31

or is a simple core-async queue

currentoor20:08:47

then i could call the functions defined in FulcroNetwork protocol

tony.kay20:08:05

not sure you need that much plumbing

tony.kay20:08:26

It’s just a simple websocket with transit that you need

tony.kay20:08:59

I guess you could use it…it has the auto-retry stuff and such

tony.kay20:08:26

well, other than that is written to run from cljs

tony.kay20:08:50

and I got the feeling you wanted to send machines messages from you back-end??? Or directly from the client UI?

tony.kay20:08:29

if you’re sending from client UI, then there is nothing to do but add it as a remote, but I thin kthat a bad idea, since you don’t want mulitple UIs possibly controlling one bit of hardware without coordination

wilkerlucio20:08:15

@currentoor you may like to use Pathom there, with connect you can build a full parser (with async support) that handles queries and mutations

currentoor21:08:06

seems like it would be more of a client than a server

currentoor21:08:23

and since i’d be using a normal app state, i could just just the default parser no?

wilkerlucio22:08:13

yeah, I think I got it wrong, I though you were talking more about communication layer, but you want to do some kind of rendering, right?

currentoor20:08:22

@tony.kay all messages to the device will come from the server not UIs

tony.kay20:08:11

yeah, so everything is inverted…none of Fulcro’s code for networking is built to work in that direction

tony.kay20:08:28

I see why you want a client on the Pi

tony.kay20:08:51

so yes, you would use that class you pointed at on the client, and then do server pushes to it

tony.kay20:08:12

but you’ll need to handle those websocket messages yourself

currentoor20:08:18

Seems to be working

tony.kay20:08:27

I guess you could try making a whole client without DOM UI

currentoor20:08:33

Able to connect to the server