connecting the api to views
@luandro sorry, this turned into a mess while I was experimenting with good patterns and trying to get things visible
Page changes
- /feed : shows the content of last 10 messages in the log
- /network : shows peers on local wifi and lets you follow them, and log out the current state if you're connected / connecting
Patterns
- in the backend
api.js
:- something which listens for messages in the
action
channel (these are coming from the UI) - publishes messages into the
mutation
channel (which the UI listens to)
- something which listens for messages in the
- in the frontend (e.g.
pages/network.js
) :- a
reducer
function which is set up to listen to incomingmutation
messages, and runssetState
as required - a
dispatch
function which dispatchesaction
messages to the backend
- a
this whole thing is like a weird spread out redux. The state using this approach is quickly going to get out of hand I think. I considered setting up Redux, but decided to defer that as long as possible and see how it felt. (In the meantime I've been coding in a redux-y type way so it might be easy to change later).
Config changes
- set
friends.hops: 1
because in the event I successfully connect to my phone I don't want to pull the whole network down! - added
ssb-about
and installed it. It's not doing anything yet... stable startups, but calling it seemed to stimulate crashes though.
Known Problems
I can see my phone from my laptop, and my laptop from my phone. I can publish follow messages but I can't get replication happening yet between devices ):
Edited by mix irving