Package detail

@mos-connection/connector

nrkno5.4kMIT4.3.0-alpha.1

MOS compliant TCP/IP Socket connection.

mos, broadcast, socket, typescript

readme

MOS-Connection

Tests codecov Quality Gate Status

@mos-connection/connector NPM Version @mos-connection/helper NPM Version @mos-connection/model NPM Version

MOS-Connection is a Node.js library to communicate, using the MOS Protocol, with systems such as Newsroom Computer Systems (NRCS) or other MOS devices.

Features include:

  • Acting as a MOS Device (ie a client), connecting to an NRCS.
  • Acting as a NRCS (ie a server), allowing other MOS Devices to connect to it.
  • Helpful tools for developing MOS Plugins and parsing MOS data.
  • A simple tool for testing MOS connections, called Quick-MOS.

This library is developed as a part of the Sofie TV Automation System.

General Sofie System Information


Packages

MOS-Connection consists of 4 packages:

  • @mos-connection/connector is a Node.js library is used to connect to MOS devices or act as a MOS Server/NCS. The helper and model functionality is included in this library as well.
  • @mos-connection/helper is a library that provides various functions useful for those that prepare/handle data that will be sent to (or has been received by) the MOS-connection. The model functionality is included in this library as well.
  • @mos-connection/model is a library that contains types and enums, useful for applications that handles MOS-data.
  • There is also a helper application QuickMos designed to be a minimal mock MOS server for testing client applications.

Getting Started

Installation

npm install @mos-connection/connector

Usage

_See more examples in the examples folder, or the QuickMos implementation!

import { MosConnection } from '@mos-connection/connector'

let mos = new MosConnection(new ConnectionConfig({
    mosID: 'my.mos.application',
    acceptsConnections: true,
    profiles: {
        '0': true,
        '1': true,
        '2': true,
        '4': true
    },
    openRelay: true
    debug: false
}))
mos.onConnection((device: MosDevice) => { // called whenever there is a new connection to a mos-device
    if (device.hasConnection) { // true if we can send messages to the mos-server
        device.getMachineInfo().then((lm) => {
            console.log('Machineinfo', lm)
        })
    }
    // Setup callbacks to pipe data:
    device.onRequestMachineInfo(() => {})
    device.onCreateRunningOrder((ro) => {})
    device.onDeleteRunningOrder((RunningOrderID: MosString128) => {})
    device.onReadyToAir(() => {})
    // ...
})

Quick-MOS

"Quick-MOS" is a simple MOS application that can be used to test the MOS-connection library.

It reads data-files from disk and pretends to be an NRCS, so you can connect other MOS-clients to it.

See Quick-MOS for more information.

MOS Support

The MOS-Connection library currently supports the MOS Protocol version 2.8.5.

Supported MOS Profiles

Profile Status
Profile 0 Implemented
Profile 1 Implemented
Profile 2 Implemented
Profile 3 Implemented
Profile 4 Implemented
Profile 5 Not implemented (yet)
Profile 6 Not implemented (yet)
Profile 7 Not implemented (yet)

Pull Requests for the remaining profiles would be happily accepted!


The NRK logo is a registered trademark of Norsk rikskringkasting AS. The license does not grant any right to use, in any way, any trademarks, service marks or logos of Norsk rikskringkasting AS.

changelog

Change Log

All notable changes to this project will be documented in this file. See Conventional Commits for commit guidelines.

4.3.0-alpha.1 (2025-06-25)

Note: Version bump only for package @mos-connection/connector

4.3.0-alpha.0 (2025-04-14)

Bug Fixes

  • in hotstandby - use secondary device upon start (2d1a69e)

4.2.2 (2025-01-22)

Bug Fixes

  • ExternalMetadata.MosPayload wasn't passed through when containing string. Changed MosPayload to be AnyXMLValue instead of AnyXMLObject. (d5cfec5)

4.2.1-alpha.0 (2025-01-10)

Note: Version bump only for package @mos-connection/connector

4.2.0 (2024-12-05)

Bug Fixes

  • Disable heartbeat on primary if secondary is active in openMediaHotStandby mode. (f550bd5)
  • failover to buddy when main not up to date (8554f60)
  • hotStandby - set heartbeats state no matter secondary's state (c2b35be)
  • parse incoming data as strings (Big Refactor) (0f0f8d3)
  • rename new test (248a4f8)
  • revert renaming to isHotStandby to avoid conflict with MOS-Gateway (562d74b)

Features

  • Add tests for openMediaHotStandby (5985b19)
  • Support for openMediaHotStandby disable heartbeat on secondary when not used (ab04e49)

4.2.0-alpha.1 (2024-08-27)

4.2.0-alpha.0 (2024-07-05)

Bug Fixes

  • parse incoming data as strings (Big Refactor) (0f0f8d3)

4.1.1 (2024-08-20)

Bug Fixes

  • failover to buddy when main not up to date (8554f60)

4.1.0 (2024-04-02)

Bug Fixes

  • add .snap file for open media test (9bb6825)
  • lint fix and Porfile0-non-strict snapsot (dfbc4c1)

Features

  • add access to stric t value un mosSocketClient (c85b837)
  • add test for opem media (18362f7)
  • new function _getMessageId to manage when no messageId (19f8231)

4.0.0 (2024-02-02)

⚠ BREAKING CHANGES

  • Changes to mosDevice.sendRequestAllMOSObjects(). MosObjects are now returned to the mosDevice.onMOSObjects() callback.

Migration guide:

// Before:
const mosObjs = await mosDevice.sendRequestAllMOSObjects()

// After:
mosDevice.onMOSObjects((mosObjs: IMOSObject[]) => {
  //
})
const ack = await mosDevice.sendRequestAllMOSObjects()

Bug Fixes

  • better handling of non-spec errors. (4b1f97c)
  • change how data fields is parsed, better handling of missing data. (bf4a084)
  • connectionStatus now returns textual status, not just empty strings, addressing #93 (23d9b16)
  • revert mosTime support of empty string. (cfc036f)
  • roStoryMove: off-spec support of single storyID tag (58ff304)
  • roStoryMoveMultiple: handle edge case of single storyID (4684116)

Features

  • support for receiving Profile 1 <mosObj> and <mosListAll> messages. (786710a)

3.0.7 (2023-12-27)

Bug Fixes

  • Add support for receiving roStoryX, roStoryY messages. (a4c110e)

3.0.5 (2023-12-18)

Bug Fixes

  • better handling of incoming data chunks. Deals with multiple <mos> and </mos> tags. (59cacb2)
  • better handling of single xml elements (f96ea1a)
  • handle replies to roReq (c100b4d)

3.0.4 (2023-06-09)

Bug Fixes

  • handover logic should leave heartbearts (d8ccca0)

3.0.3 (2023-06-09)

Bug Fixes

  • handover logic should leave heartbearts (d8ccca0)

3.0.2 (2023-03-27)

Note: Version bump only for package @mos-connection/connector

3.0.0 (2023-02-03)

Note: Version bump only for package @mos-connection/connector

3.0.0-alpha.3 (2023-01-27)

Note: Version bump only for package @mos-connection/connector

3.0.0-alpha.2 (2023-01-27)

Note: Version bump only for package @mos-connection/connector

3.0.0-alpha.1 (2023-01-27)

Note: Version bump only for package @mos-connection/connector

v3.0.0-alpha.0 (2022-12-09)

Bug Fixes

  • better cleanup on dispose (a241d78)

Features

  • move helper functions into a separate package: $mos-connection/helper (ecb51ec)
  • move types and enums to @mos-connection/model (2266488)