# Interface StreamBundle

interface StreamBundle {
getAvailablePaths(): Path[];
getBus(path?: Path): Bus<NormalizedDelta>;
getSelfBus(path: Path): Bus<NormalizedDelta>;
getSelfStream(path?: Path): Bus<Value>;
}

- Defined in streambundle.ts:5

##### Index

### Methods

getAvailablePaths
getBus
getSelfBus
getSelfStream

## Methods

### getAvailablePaths

- getAvailablePaths(): Path[]

  Get a list of available full data model paths maintained by the server.

  #### Returns Path[]

  #### Example

      app.streambundle.getAvailablePaths();

  Returns

      [
        "navigation.speedOverGround",
        "navigation.courseOverGroundTrue",
        "navigation.courseGreatCircle.nextPoint.position",
        "navigation.position",
        "navigation.gnss.antennaAltitude",
        "navigation.gnss.satellites",
        "navigation.gnss.horizontalDilution",
        "navigation.gnss.positionDilution",
        "navigation.gnss.geoidalSeparation",
        "navigation.gnss.type","navigation.gnss.methodQuality",
        "navigation.gnss.integrity",
        "navigation.magneticVariation",
      ]

  - Defined in streambundle.ts:152

### getBus

- getBus(path?: Path): Bus<NormalizedDelta>

  Get a Bacon JS stream for a Signal K path that will stream values from any context.

  Stream values are objects with the following structure:

        {
          path: ...,
          value: ...,
          context: ...,
          source: ...,
          $source: ...,
          timestamp: ...
        }

  #### Parameters

  - `Optional` path: Path

    If it is not provided the returned stream produces values for all paths.

  #### Returns Bus<NormalizedDelta>

  #### Example

      app.streambundle
        .getBus('navigation.position')
        .onValue(pos => app.debug(pos));

      /* output
      {
        path: 'navigation.position',
        value: { longitude: 24.7366117, latitude: 59.72493 },
        context: 'vessels.urn:mrn:imo:mmsi:2766160',
        source: {
          label: 'n2k-sample-data',
          type: 'NMEA2000',
          pgn: 129039,
          src: '43'
        },
        '$source': 'n2k-sample-data.43',
        timestamp: '2014-08-15T19:00:02.392Z'
      }
      {
        path: 'navigation.position',
        value: { longitude: 24.82365, latitude: 58.159598 },
        context: 'vessels.urn:mrn:imo:mmsi:2766140',
        source: {
          label: 'n2k-sample-data',
          type: 'NMEA2000',
          pgn: 129025,
          src: '160'
        },
        '$source': 'n2k-sample-data.160',
        timestamp: '2014-08-15T19:00:02.544Z'
      }
      */

  - Defined in streambundle.ts:59

### getSelfBus

- getSelfBus(path: Path): Bus<NormalizedDelta>

  Get a Bacon JS stream for path from the `vessels.self` context.

  #### Parameters

  - path: Path

    If it is not provided the returned stream produces values for all paths.

  #### Returns Bus<NormalizedDelta>

  #### Example

       app.streambundle
         .getSelfBus('navigation.position')
         .onValue(pos => app.debug(pos));

  Output:

      {
        path: 'navigation.position',
        value: { longitude: 24.7366117, latitude: 59.72493 },
        context: 'vessels.urn:mrn:signalk:uuid:a9d2c3b1-611b-4b00-8628-0b89d014ed60',
        source: {
          label: 'n2k-sample-data',
          type: 'NMEA2000',
          pgn: 129039,
          src: '43'
        },
        '$source': 'n2k-sample-data.43',
        timestamp: '2014-08-15T19:00:02.392Z'
      }
      {
        path: 'navigation.position',
        value: { longitude: 24.7366208, latitude: 59.7249198 },
        context: 'vessels.urn:mrn:signalk:uuid:a9d2c3b1-611b-4b00-8628-0b89d014ed60',
        source: {
          label: 'n2k-sample-data',
          type: 'NMEA2000',
          pgn: 129025,
          src: '160'
        },
        '$source': 'n2k-sample-data.160',
        timestamp: '2014-08-15T19:00:02.544Z'
      }

  - Defined in streambundle.ts:102

### getSelfStream

- getSelfStream(path?: Path): Bus<Value>

  Get a Bacon JS stream for a path in the `vessels.self` context.

  Note

  This is similar to getSelfBus, except that the stream values contain only the `value` property from the incoming deltas.

  #### Parameters

  - `Optional` path: Path

  #### Returns Bus<Value>

  #### Example

      app.streambundle
        .getSelfStream('navigation.position')
        .onValue(pos => app.debug(pos));

  Output:

        my-signalk-plugin { longitude: 24.736677, latitude: 59.7250108 } +600ms
        my-signalk-plugin { longitude: 24.736645, latitude: 59.7249883 } +321ms
        my-signalk-plugin { longitude: 24.7366563, latitude: 59.7249807 } +174ms
        my-signalk-plugin { longitude: 24.7366563, latitude: 59.724980699999996 } +503ms

      @param path -

  - Defined in streambundle.ts:125