Skip to content

Commit a25fbc2

Browse files
committed
Initial commit
0 parents  commit a25fbc2

15 files changed

+1903
-0
lines changed

.gitignore

+35
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
# Logs
2+
logs
3+
*.log
4+
npm-debug.log*
5+
6+
# Runtime data
7+
pids
8+
*.pid
9+
*.seed
10+
11+
# Directory for instrumented libs generated by jscoverage/JSCover
12+
lib-cov
13+
14+
# Coverage directory used by tools like istanbul
15+
coverage
16+
17+
# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files)
18+
.grunt
19+
20+
# node-waf configuration
21+
.lock-wscript
22+
23+
# Compiled binary addons (http://nodejs.org/api/addons.html)
24+
build/Release
25+
26+
# Dependency directory
27+
# https://docs.npmjs.com/misc/faq#should-i-check-my-node-modules-folder-into-git
28+
node_modules
29+
30+
# IntelliJ
31+
.idea/
32+
*.ipr
33+
*.iws
34+
*.iml
35+
.idea_modules

Gruntfile.js

+41
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
module.exports = function(grunt) {
2+
'use strict';
3+
4+
grunt.util.linefeed = '\n';
5+
grunt.initConfig({
6+
pkg: grunt.file.readJSON('package.json'),
7+
banner: '/*!\n' +
8+
' * OBS WebSocket Javascript API (<%= pkg.name %>) v<%= pkg.version %>\n' +
9+
' * Author: <%= pkg.author %>\n' +
10+
' * Repo: <%= pkg.repository.url %>\n' +
11+
' */\n\n' +
12+
'\'use strict\';\n\n',
13+
14+
jsdoc2md: {
15+
docs: {
16+
src: ['src/obs-source.js', 'src/obs-scene.js', 'src/obs-websocket.js', 'src/obs-events.js', 'src/obs-requests.js'],
17+
dest: 'dist/DOCUMENTATION.md'
18+
}
19+
},
20+
clean: {
21+
dist: 'dist'
22+
},
23+
concat: {
24+
options: {
25+
banner: '<%= banner %>',
26+
stripBanners: false
27+
},
28+
obswebsocket: {
29+
// src: ['src/*.js'],
30+
//dest: 'dist/<%= pkg.name %>.js'
31+
src: ['src/obs-source.js', 'src/obs-scene.js', 'src/obs-websocket.js', 'src/obs-crypto.js', 'src/obs-events.js', 'src/obs-requests.js'],
32+
dest: 'dist/obs-websocket.js'
33+
}
34+
}
35+
});
36+
37+
require('load-grunt-tasks')(grunt, { scope: 'devDependencies' });
38+
39+
grunt.registerTask('build', ['clean:dist', 'concat']);
40+
grunt.registerTask('default', ['build', 'jsdoc2md']);
41+
};

LICENSE.md

+22
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
2+
The MIT License (MIT)
3+
4+
Copyright (c) 2016 Brendan Hagan
5+
6+
Permission is hereby granted, free of charge, to any person obtaining a copy
7+
of this software and associated documentation files (the "Software"), to deal
8+
in the Software without restriction, including without limitation the rights
9+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10+
copies of the Software, and to permit persons to whom the Software is
11+
furnished to do so, subject to the following conditions:
12+
13+
The above copyright notice and this permission notice shall be included in all
14+
copies or substantial portions of the Software.
15+
16+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22+
SOFTWARE.

README.md

+59
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
# obs-websocket-js
2+
OBSWebSocket.JS allows Javascript-based connections to [obs-websocket](https://github.com/Palakis/obs-websocket).
3+
Based heavily on [obs-remote](https://github.com/nodecg/obs-remote-js), which is built for the older, obs-classic compatible plugin.
4+
5+
# [API Documentation](dist/documentation.md)
6+
7+
## Usage
8+
9+
### Plain Javascript
10+
Include the distributable file in the header of your HTML.
11+
```html
12+
<script type='text/javascript' src='dist/obs-websocket.js'></script>
13+
```
14+
15+
Then make use of it.
16+
```html
17+
<script>
18+
var ws = new OBSWebSocket();
19+
20+
// Bind some listeners.
21+
ws.onConnectionOpened = function() {
22+
console.log('Connection Opened');
23+
24+
// Send some requests.
25+
ws.getCurrentScene(function(message) {
26+
console.log(message);
27+
});
28+
};
29+
30+
// Open the connection and Authenticate if needed. URL defaults to localhost:4444
31+
ws.connect(); // ws.connect('url', 'password');
32+
</script>
33+
```
34+
35+
36+
### NodeJS
37+
```sh
38+
npm install obs-websocket-js --save
39+
```
40+
41+
Add the library to your application.
42+
```js
43+
var OBSWebSocket = require('obs-websocket-js');
44+
var obsWS = new OBSWebSocket();
45+
46+
obsWS.connect('url', 'password');
47+
```
48+
49+
# Contributing
50+
- Install [node.js](http://nodejs.org).
51+
- Clone the repo.
52+
- Go nuts.
53+
- Generate the concatenated Javascript file and API documentation by running the following...
54+
```sh
55+
npm run build
56+
```
57+
58+
## Formatting Guidelines
59+
- 2 spaces rather than tabs.

0 commit comments

Comments
 (0)