Reference · SDK
connect(session, platform)
functiontechne-sdk/connect
techne is the pair of clients for one signed-in person: their PDS, and the platform reached through it.
Writes go to the person's PDS. Reads reach techne.computer through the PDS too. Each request carries atproto-proxy, and the PDS signs it for the person. So every read knows its viewer, and your app holds no credential for the platform.
Parameters
| Name | Type | What it is |
|---|---|---|
sessionrequired | { did, fetchHandler } | The person's OAuth session. What restore answers works as it comes. |
platformrequired | string | The platform's service DID. Its DID document names the endpoint, so a move to another host changes nothing in your app. |
Returns Techne
| Name | Type | What it is |
|---|---|---|
did | string | The person's DID. Every write goes to that repo. |
pds | AtpBaseClient | Their PDS, as them. |
platform | AtpBaseClient | The platform, through their PDS: every method of the reference, as techne.platform.pub.techne.draft.…. |
The one write is put(techne, records) from techne-sdk/put. The generic reads, listRecords and getRecords, are in techne-sdk/query. An app that holds only a platform session uses connectHosted(did, fetchHandler) instead.
Connect, read, write
Public reads, nobody signed in
With nobody signed in there is no session to connect. A client pointed at the platform itself calls its public methods, public records only. Writes need connect.