Package Exports
- beam-interactive-node2
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 (beam-interactive-node2) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
Beam Interactive Node 2
A TypeScript, NodeJS and Browser compatible client for Beam.pro's interactive 2 Protocol.
For an introduction to interactive2 checkout the reference docs on the developers site.
Installation
You can use npm(recommended) or download a zip from the releases page.
Browser
<script src="dist/interactive.js"></script>Node
npm i --save beam-interactive-node2Usage
Authentication
OAuth 2.0 is used for authentication. Valid bearer tokens can be passed in the Client.open method.
For more information about Beam's OAuth visit the OAuth reference page on our developer site.
Browser
index.html
<doctype html>
<html>
<head>
<title>Interactive 2</title>
</head>
<body>
<script src="js/interactive.js"></script>
<script src="js/app.js"></script>
</body>
</html>app.js
const client = new interactive.GameClient();
client.open({
authToken: '<OAuth Token>',
url: '<Server Url>',
versionId: 1234,
});Node
JavaScript
const interactive = require('beam-interactive-node2');
const ws = require('ws');
interactive.setWebSocket(ws);
const client = new interactive.GameClient();
client.open({
authToken: '<OAuth Token>',
url: '<Server Url>',
versionId: 1234,
});TypeScript
import { GameClient, setWebSocket } from 'beam-interactive-node2';
import * as ws from 'ws';
setWebSocket(ws);
const client = new GameClient();
client.open({
authToken: '<OAuth Token>',
url: '<Server Url>',
versionId: 1234,
});Examples
Checkout our examples to get up to speed quickly!
- basic - Connects and sets up 5 buttons, when they are clicked the participant is charged 1 spark.
- dynamicControls - Connects and then creates and destroys 5 buttons with random text.
- joystick - Connects and creates a joystick, logs participant coordinate values.
Documentation
Checkout our reference docs here.
Development
To get a development environment setup:
- Clone this repository
npm installnpm run build
Contributing
Thanks for your interested in contributing, checkout TODO.md for a list of tasks!
Open a Pull Request we'd love to see your contributions.