Closed fancycade closed 4 years ago
Great work, this is an interesting approach! I'll need some time to play around with it and think through the architecture but one of the first things which stands out to me is that we may want to include some of this in the SDK. I'm not sure where the boundaries lie yet, though I think this project will be a great way to clarify that. Cryptography will also be a factor. Thoughts?
I also think decoupling state from logic is a good call 👍
Had some time to think about this for a bit.
One area that might get put in the SDK is dealing with responses. For example the response to sync can be quite complex, and it might make sense to abstract that in the SDK.
Another thought is to make the SDK stateless and push all the state modules here.
One area that might get put in the SDK is dealing with responses. For example the response to sync can be quite complex, and it might make sense to abstract that in the SDK.
I think the request handler
included here is probably a good layer to add to the SDK and expand on.
Another thought is to make the SDK stateless and push all the state modules here.
I think the SDK will need some tools to handle state (optional of course for users). This will abstract session management, encryption and more... I currently view this project as a sandbox where we can play with these concepts and choose where the boundaries of the SDK lie. Matrix is also moving towards P2P, the SDK should cover the server side of things in future (long term). Thoughts?
Note: I'll be looking through this over the next few days, thanks for being patient and sorry I couldn't get to this sooner!
I think the request
handler
included here is probably a good layer to add to the SDK and expand on. Yeah that seems like a good idea.I think the SDK will need some tools to handle state (optional of course for users). This will abstract session management, encryption and more..
After looking at the encryption side, I can see why the SDK would include state. My only addition here is we will have to see how complicated this library gets. I'm hoping to work on this some more this weekend.
After looking at the encryption side, I can see why the SDK would include state. My only addition here is we will have to see how complicated this library gets. I'm hoping to work on this some more this weekend.
Great, let me know if you want to talk through anything. What I've seen so far looks good; I'll convert the PR to draft for now.
I've made some progress on basic usage like creating a room and sending a message.
Currently I am stuck on accepting invites to a room. The invite doesn't show up in the sync state. @niklaslong do you think you could take a look at this?
Only idea I have right now is that the invite isn't showing up in the initial sync, and maybe will show up in later calls, but I'm really not sure. You can see an example in the last test, and the sync call outputs the data with IO.inspect for right now.
Strange indeed, have you tried reading events from our room for example? I invited you initially, might be worth checking state there. It might also be interesting to check the room under test with Element to see if the event is registered?
I can try those rooms as sanity checks, certainly possible I might be missing something.
It may be related to the push rules: https://matrix.org/docs/spec/client_server/latest#id91
I think this PR is "basic usage" so far, and the next phase will be to make it more user friendly.
@niklaslong I excluded the whole test module for now, but if there are other unit tests added later we can always change that.
Session process for storing state related to user session Synchronizer process that is linked to a session used for updating syncing session state with the server MatrixClient proper provides an easy to use interface to work with sessions
My idea was to decouple the state from the logic as much as possible for the user. Originally, I had a GenServer but if one of the methods failed it wiped the state. This way is a bit more fault tolerant.
This is very much still a WIP. Lucky me, I get to dive into syncing state right out of the gate haha
Wanted to let you have a look and see if I'm not completely crazy :sweat_smile: