npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

cm-janus

v0.8.22

Published

cm-janus [![Build Status](https://travis-ci.org/cargomedia/cm-janus.svg?branch=master)](https://travis-ci.org/cargomedia/cm-janus) [![codecov.io](https://codecov.io/github/cargomedia/cm-janus/coverage.svg?branch=master)](https://codecov.io/github/cargomed

Downloads

63

Readme

cm-janus Build Status codecov.io

About

Bridge between cm-application and janus-gateway. Once running it should:

Dependency Installation

Because cm-janus uses node-inotify that works only in GNU/Linux, dependency installation may fall on any other OS. To solve this you need install dependencies in Linux environment. For Vagrant users there is a prepared vagrant file.

  • So start vagrant vagrant up
  • Tunnel vagrant ssh
  • Go to cm-janus dir cd ./cm-janus
  • Run npm install

Installation

Install as npm package:

npm install cm-janus

Running

Run services using:

bin/cm-janus

Config

cm-janus is based on single configuration file written in yaml format. Default config is present under bin/config.yaml. You can provide different config file using -c option (e.g. bin/cm-janus -c /path/to/my/config/yaml). New config will completely overwrite old one. Old one won't be used for defaults.

Config format:

logPath: 'log/app.log' # path to log file (relative to working dir)
httpServer:
  port: 8888 # port for incoming http api requests
  apiKey: '123fish' # token for authenticating incoming http request
webSocketServer:
  port: 8188 # port for incoming WebSocket connections
janus:
  webSocketAddress: 'ws://198.23.87.26:8188/janus' # janus-gateway webSocket address
  httpAddress: 'http://198.23.87.26:8188/janus' # janus-gateway http address
cmApi:
  baseUrl: 'http://www.cm.dev/rpc' # cm-application address
  apiKey: '123fish' # token for authentication, sent with each http request
cmApplication:
  path: '/home/cm' # path to local cm application
jobManager:
  jobsPath: '/tmp/jobs' # place where job definitions are stored
  jobRetryDelay: 60 # seconds delay to restart failed jobs
  tempFilesPath: '/tmp/jobs/temp-files/' # jobs handlers' temp files
  handlersConfiguration: # configuration of jobs handlers. Names in `<%= %>` delimiters are placeholders for commands arguments
    'janus.plugin.cm.audioroom:archive-finished': # audio recording job handler
      convertCommand: 'lame <%= wavFile %> <%= mp3File %>' # a command to use for converting wav into mp3
    'janus.plugin.cm.rtpbroadcast:archive-finished': # video recording job handler
      mergeCommand: 'mjr2webm <%= videoMjrFile %> <%= audioMjrFile %> <%= webmFile %>' # a command to use for merging video/audio mjr into single webm
    'janus.plugin.cm.rtpbroadcast:thumbnailing-finished': # video thumbnail job handler
      createThumbnailCommand: 'mjr2png <%= videoMjrFile %> 1920 560 <%= pngFile %>' # a command to use for converting mjr into png

Roles

By default cm-janus runs for all roles (server, jobs). This can be limited by passing -r argument (e.g. bin/cm-janus -r server,jobs).

Http API

cm-janus provides HTTP API. Its connection details are specified in httpServer part of config.

/stopStream

Stops stream.

  • params:

    • streamId {String}. required. Id of stream to stop.
  • method: POST.

  • Response: {success: 'Stream stopped'} or {error: '<reason>'}.

  • Example curl request:

    curl -H "Server-Key:yourSecretKey" -X POST -d "streamId=12312" http://localhost:8888/stopStream

/status

Gets status of all current streams.

  • params: None.

  • method: GET.

  • Response: Array of serialized streams. Example: [{id: <StreamId>, channelName: <ChannelName>}].

  • Example curl request:

    curl -H "Server-Key:yourSecretKey" http://localhost:8888/status

Logging

cm-janus reports about events using log4js logging system. It logs into console (output) and file (set in config.yaml). Log entries are encoded in JSON an contain various fields. Default timestamp, level, message and additional ones passed with Context.

Context

Context usually contains event's additional information about corresponding resources e.g. plugin, session, connection. There is a possibility to assign additional values from external services via WebSocket url. There is special ?context param which should contain json-encoded key-values which will be assigned into Connection's context object. E.g.

ws://cm-janus:8188?context={"key":"value"}

Testing

cm-janus uses node-inotify that works only in GNU/Linux. To run tests on any other platform you need to setup a virtual Linux environment. For Vagrant users there is a prepared vagrant file.

  • So start vagrant vagrant up
  • Tunnel vagrant ssh
  • Go to cm-janus dir cd ./cm-janus
  • Run tests npm run-script test If you are already in Linux then run only last two steps.

Publishing

  • update package.json with a new version
  • release a new git tag with the updated package.json

After that the npm release should be done automatically. If it didn't happen then release it manually:

npm publish https://github.com/cargomedia/cm-janus/archive/<GitTagWithUpdatedPackageJson>.tar.gz