1.6.2 • Published 1 month ago

rtmp-client v1.6.2

Weekly downloads
63
License
ISC
Repository
github
Last release
1 month ago

npm version

About

RTMP client.

Usage

Install using npm:

$ npm install rtmp-client

NetConnection

const { NetConnection } = require('rtmp-client');

const nc = new NetConnection();
nc.onStatus = function (info) {
	if (info.code === 'NetConnection.Connect.Success') {
		nc.call('foo', {
			'onResult': console.log.bind(console),
			'onStatus': console.error.bind(console),
		}, 'bar');
	}
};
nc.rpcName = async function (...args) {
	console.log('server called rpcName', ...args);
};
nc.connect('rtmp://127.0.0.1:1935/app/instance');

Documentation: netconnection-class.html

SharedObject

Since there was nothing in the RTMP spec about the messages, I've documented them in SharedObject.md

const so = SharedObject.get('foo', false, nc);
so.onStatus = (info) => {
	console.log(info);
};
so.onSync = (list) => {
	console.log('shared object changes', list);
};

Documentation: sharedobject-class.html

Client

The Client class used behind NetConnection is also exported but undocumented.

Check the source code in Client.js if you need to use it for example to create an RTMP server.

const { Client } = require('rtmp-client');

Implementation status

  • NetConnection
  • SharedObject - x basic functionality - x lock()/unlock() (non-proxied) - mark()/send()/handlerName()
  • Stream
  • NetStream

Lock/unlock

Based on observation lock() should defer writes from clients until unlock() is called.

Right now this functionality is not directly implemented, but technically consumer code could simulate it.

1.6.2

1 month ago

1.6.1

3 months ago

1.6.0

4 months ago

1.5.4

5 months ago

1.5.3

1 year ago

1.5.2

2 years ago

1.5.1

2 years ago

1.4.3

2 years ago

1.5.0

2 years ago

1.4.2

2 years ago

1.4.1

2 years ago

1.4.0

2 years ago

1.2.0

2 years ago

1.1.4

2 years ago

1.3.0

2 years ago

1.2.1

2 years ago

1.1.3

3 years ago

1.1.2

3 years ago

1.1.1

3 years ago

1.1.0

3 years ago

1.0.2

3 years ago

1.0.0

3 years ago

1.0.1

5 years ago