frankly-js
Frankly Chat SDK for web browsers and Node.js applications.
Installation
The simplest way to install this module is to use the deployed package on npm:
$ npm install frankly-js
Usage (Node.js)
After installing the SDK you can import it like any standard node module using the require function, here's a quick example of how this is usually done:
var frankly = // Create a client that interacts with the Frankly API over HTTP, ideal for// efficient server-to-server operations.var client = 'https'var key = '...'var secret = '...' // Opens the client to make operations on behalf of the admin user of the app.client // Send a sticky message to a room with id 42.client
Usage (Browsers)
The code is also published online and can be embeded directly into a web page:
Formatting
Follows https://github.com/feross/standard
$ npm install standard -g
$ standard --format
Building
To build the JS SDK, determine your version (as {$version}
), and run
$ ./scripts/build ./dist {$version}
Testing
mocha
is required to run the test suite, the following environment variables
also have to be set:
FRANKLY_APP_HOST
usually set to https://app.franklychat.comFRANKLY_APP_KEY
the app key obtained from the Frankly Console.FRANKLY_APP_SECRET
the app secret obtained from the Frankly Console.
then simply run
$ npm test
To run a single test in isolation, run
$ mocha test/[name-of-test-file.js] --timeout=10000
Documentation
To create documentation for the JS SDK, make sure you have jsdoc installed and run
$ ./scripts/gendoc ./doc
The reference documentation can be found at http://franklyinc.github.io/APIReference-JavaScript.html