-
-
Notifications
You must be signed in to change notification settings - Fork 596
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Lack of examples and documentation #608
Comments
https://github.com/matrix-org/matrix-js-sdk#api-reference |
I have now written a simple client and am working on implementing e2e crypto on it. While the e2e impl. guide helps for understanding the protocol, it is unclear how much is covered by the sdk and should be called by the client, and how much is internal. I do not think usage examples, or more strict guide-lining would hurt the project. The existing usage examples are very nice, and do not need to be exhaustive, but could say ".. see the rest of the events here." whilst pointing to the events in the reference or similar. |
here is a list of all functions of the MatrixClient class I found it a bit difficult to discover all functions without an index, so I created one new MatrixClient(opts) |
@theilgaard can you please share how you wrote your client using e2e with this sdk? I would really appreciate it. |
Still very true—the docs are a disaster. Improving on them might make Matrix a lot more appealing to developers. For example, notice how clear Twitter's docs are. They don't just have a clear, categorized API reference, but also guides that explain use cases. Try replicating that; how does one set up the client, how to get all conversations, how to paginate, what are filters, how to get user info, how to implement push rules, how to implement crypto, etc. |
Given a choice between improving the usability, performance and stability of Matrix’s reference implementations so that people can actually use it in favour of Slack/Discord/WhatsApp... versus building SDK doc websites, we’re prioritising the former. This is an open source project. Agreed that the js-sdk docs could be improved - we will very gladly accept contributions to improve them. It doesn’t all have to come from the core team; enough people have figured out the js sdk sufficiently to help write tutorials and glossy doc. |
Very understandable. Making those docs does sound like a fun project :) But I'm unsure people outside the core team are going to invest their spare time and effort in writing them. |
that would be the tragedy of the commons, then (doubly so on a bug tagged “help wanted” and “easy”). |
It's also a chicken-or-egg situation :D Better docs → more clients → more interest → more contributions → better docs. Perhaps we only need to kickstart it with a better doc foundation, and then pin an issue to the top of this repo asking people to write content. Worked out pretty well for React Native. |
I agree with others that a basic skeleton series of "How to" will get things started much faster. Also it gets developers like me interested and can contribute back to the documentation. At the moment even I want to I don't know how to do these things like "how to get unread count", "how to set read receipt". The more basic documents the Core team could provide, the more active the community is, hence more help on the document. Just my two cents. |
Open source clxxxd documentation |
I'm interested in helping with this. As @Dexwell wisely pointed out, it is somewhat of a chicken and egg situation! It's hard to contribute when the existing documentation is quite minimal. I have a question. Shouldn't the API be the same in every SDK? With the only differences being the Grammar? Shouldn't this make documentation really easy? I'm not attempting to criticize, just understand how perhaps I might be able to help and to see perhaps some symmetry across the SDKs that might reduce maintenance. |
Apparently the docs here are nearly 3 years old, but yet, they are JSDoc so presumably have been autogenerated. I couldn't find the repo where those docs are stored. Could someone tell me how I could help in this area? |
Hence you should probably use the index https://matrix-org.github.io/matrix-js-sdk/ which has the docs for newer versions of the SDK. This index is linked to in the README of this repo. All those docs are generated via the package.json script and stored in https://github.com/matrix-org/matrix-js-sdk/tree/gh-pages |
Thanks for the link. Still, unfortunately it seems like that doc doesn't show what would seem to be the most basic use cases, such as Registering and Creating a room. For even the most simple cases, it seems like the docs are unhelpful. If the docs do explain it, I can't see it on the surface, and I have made more progress just by reading the source code. |
I'm trying to figure out a basic workflow for Register, Login, Create Room, Send Message. It seems like Registration requires an authSessionId, but I can't find anything that returns it, so I don't know how to get it. And do you need to do a guestRegister before you do a register? I put an guest_access_token from guestRegister into register and the token was considered invalid, yet the documentation says that a guest_access_token is required. |
The API reference is good, and I've been relying on that ever since. But I agree that there should be a guide for developers that teaches the fundamentals. The only guides that I know of are the ones from the README and https://matrix.org/docs/guides/usage-of-the-matrix-js-sdk. Synapse includes its documentation in the repo and hosts it here: https://matrix-org.github.io/synapse/latest/. Maybe we can do the same with matrix-js-sdk? |
Hi everyone, Is there any news on this topic? It's been some weeks I'm using this SDK, and I'm affraid I'm not using it the right way. Would be great to dedicate some time on a repo, at least. I'd be happy to help on this, if at least some one experienced with this SDK is available. |
Nope. After 18 years im still trying to restore a backup. |
Been trying to understand this sdk and how to integrate it into a react app by reading the code in the repo and in https://github.com/matrix-org/matrix-react-sdk/ but it has proven difficult. I've been trying to attach to timeline events but I'm missing core concepts like: what is a timeline set? Can't find any documentation on it anywhere. |
When you want to understand the concept behind all you should Read the Client-Server API: also: I wrote some "debugging" tool to see data directly from the server. This helped me also understand the data which is transferred. Also how data looks in RAW. When working with matrix-js-sdk you need to be careful because you are working with the SDK event system and also with Reacts state management. It can be ugly when you're not skilled in any of this.
|
any way of working with notifications? i'm been trying to find a way to see the list of unread notifications (not only the count), but I can't seem to find a way to do this with this sdk. |
The Room Model has getAccountData which you can get the latest event you read. matrix-js-sdk/src/models/room.ts Line 2822 in 1645867
.getAccountData('m.full_read') -> gives you the latest event you read. So you could check if some notifications are there with the count and then check which event you read at last. After that get the timelineset for this event forwards. But I wouldnt recommended this. You also just take the live timelineset check if fthe full_read event is in there. Because theoreticly it could lead to performance issues when the event is realy old and thousand of other events are in between. Also no warranty ;) |
duplicate of #430 |
Sorry but I just spent hours trying to figure out how to get the most basic things to work. I had to look through google and ask colleagues to even find the right documentation.
It seems you expect developers to read your source code to understand how things work.
If there is any link to prove me wrong please add it here or in the Readme (in a place ewhere everybody can see it)
To me it seems like a waste of time to even try integrating this in my app. I'm not sure if that is the feeling you want to reflect on developers.
The text was updated successfully, but these errors were encountered: