# ConnectionManagementSessionMixin

Auto-generated from the @jbrowse/mobx-state-tree model in the source — see the [developer guide](https://jbrowse.org/jb2/docs/developer_guide/) for concepts. Built into JBrowse core. [View source](https://github.com/GMOD/jbrowse-components/blob/main/packages/product-core/src/Session/Connections.ts).

Adds connections to a session: the connection instances it has made, and
the configs of the connection tracks the user opened, so those tracks load
on session restore without reconnecting.

## Properties

| Member | Description |
| --- | --- |
| **connectionInstances**<br><code>connectionInstances: types.stripDefault( types.array(pluginManager.pluggableMstType('connection', 'stateModel')), [], )</code> |  |
| **connectionTrackConfigs**<br><code>connectionTrackConfigs: types.stripDefault( types.frozen&lt;Record&lt;string, ConnectionTrackConfigEntry&gt;&gt;(), {}, )</code> | Persisted configs of connection tracks the user has opened, keyed by trackId. Unlike `connectionInstances` (stripped from snapshots, holds the whole fetched hub), this holds only the tracks in use, so an open connection track resolves synchronously on session load without re-establishing the connection. |

## Getters

| Member | Description |
| --- | --- |
| **connections**<br><code>(ConfigNodeProps&lt;…&gt; &amp; ConfigNodeActions &amp; ConfigNodeBrand&lt;ConfigurationSchemaType&lt;{ readonly name: { type: "string"; } &amp; { defaultValue: string; }; readonly assemblyNames: { type: "stringArray"; } &amp; { defaultValue: unknown; }; connectionId: { type: "string"; } &amp; { defaultValue: string; }; type: { type: "string"; } &amp; { defaultValue: string; }; }, ConfigurationSchemaOptions&lt;undefined, "connectionId", true, ConfigurationSchemaRequirement&lt;Partial&lt;Record&lt;string, string[]&gt;&gt;, string&gt;, any&gt;&gt;&gt;)[]</code> |  |

## Actions

| Member | Description |
| --- | --- |
| **makeConnection**<br><code>(configuration: AnyConfigurationModel, initialSnapshot?: object) =&gt; any</code> |  |
| **breakConnection**<br><code>(configuration: AnyConfigurationModel) =&gt; void</code> | Remove a live connection instance. Tolerant of an already-dormant connection (its instance is stripped from the session on reload). Leaves persisted open-track configs alone — the connect() error path calls this and the user's already-open tracks must survive a transient failure. Full removal goes through `deleteConnection`. |
| **teardownConnection**<br><code>(configuration: AnyConfigurationModel) =&gt; void</code> | Close every track a connection contributed — the live instance's tracks plus any persisted open-track configs (a dormant connection, never expanded this session, still renders its opened tracks from `connectionTrackConfigs`) — from all views/widgets, drop the live instance, and drop the persisted configs. The session is left as if the connection had never loaded. |
| **deleteConnection**<br><code>(configuration: AnyConfigurationModel) =&gt; any</code> | Fully remove a connection: tear down its tracks and live instance, then delete its config. |
| **addConnectionConf**<br><code>(connectionConf: AnyConfiguration) =&gt; any</code> | Adds to the **config**, not the session: `jbrowse.connections`, which every visitor to this instance loads. jbrowse-web overrides this so a non-admin's connection lands in `sessionConnections` instead — see WebSessionConnectionsMixin, whose `addSessionConnectionConf` is what to call when you mean the session specifically rather than "wherever this user's edits go".<br><br>Applications without that override (Desktop, the embedded products) have only this one destination, and it is the right one there: their config and session are saved as a single document. |
| **clearConnections**<br><code>() =&gt; void</code> |  |
| **captureConnectionTrack**<br><code>(trackId: string) =&gt; void</code> | Snapshot a just-opened connection track's config into `connectionTrackConfigs` so it survives session reload. No-op if the track isn't connection-provided or is already captured (edits go through `updateConnectionTrackConfig`). |
| **updateConnectionTrackConfig**<br><code>(trackConf: Record&lt;string, unknown&gt; &amp; { trackId: string; }) =&gt; void</code> | Persist an edit to an opened connection track. The full config is stored (not a delta): the connection's fetched "base" isn't present at load, so only a complete config resolves synchronously. |
| **setConnectionTrackConfig**<br><code>(trackId: string, connectionId: string, config: Record&lt;string, unknown&gt;) =&gt; void</code> | Upsert one opened connection track's persisted config. |
| **pruneConnectionTrackConfig**<br><code>(trackId: string) =&gt; void</code> | Drop a connection track's persisted config once no open view still references it, so the session doesn't accumulate closed tracks. |
| **hydrateConnection**<br><code>(connectionId: string) =&gt; void</code> | Lazily establish a single connection by id if it isn't already live; the track selector calls it when the connection's category is expanded. Fetches without launching a view or showing a success snackbar; already-open tracks keep rendering from `connectionTrackConfigs` meanwhile. Idempotent. |

