Package Exports
- obs-websocket-js
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (obs-websocket-js) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
obs-websocket-js
OBSWebSocket.JS allows Javascript-based connections to obs-websocket.
Based heavily on obs-remote, which is built for the older, obs-classic compatible plugin.
API Documentation
Distributable
Usage
Plain Javascript
Include the distributable file in the header of your HTML.
<script type='text/javascript' src='dist/obs-websocket.js'></script>
Then make use of it.
<script>
var ws = new OBSWebSocket();
// Bind some listeners by assigning functions, with params if applicable.
ws.onConnectionOpened = function() {
console.log('Connection Opened');
// Send some requests by calling existing functions and passing callbacks.
ws.getCurrentScene(function(err, data) {
console.log(err, data);
});
};
// Open the connection and Authenticate if needed. URL defaults to localhost:4444
ws.connect(); // ws.connect('url', 'password');
</script>
NodeJS
npm install obs-websocket-js --save
Add the library to your application.
var OBSWebSocket = require('obs-websocket-js');
var obsWS = new OBSWebSocket();
obsWS.connect('url', 'password');
Contributing
- Install node.js.
- Clone the repo.
- Go nuts.
- Generate the concatenated Javascript file and API documentation by running the following...
npm install
npm install --only=dev
npm run build
- Run grunt watch using the following. This will only update the distribution js file, not the markdown.
npm run grunt watch
Formatting Guidelines
2 spaces rather than tabs.