Provide a nice and simple way to handle remote connections from any devices (phones, tablets, etc...)
Table of content
Install
npm install coffeekraken-remote-stack --save-dev
Get Started
This package expose multiple entry points to cover each parts of a remote client/app structure. Here's the list of entries that you will have access to:
- API
Client
: The client js api that helps you connect, announce and send instructions to the appApp
: The app js api that helps you to announce your app into a specific room and receive the clients instructionsRoom
: The room js api that let you send data to the room app or clients
- Server : The nodejs that is responsible for:
- Connect the client and the app
- Expose some rooms to connect to
- Handle room's clients queue and picking strategy
Client API
Here's how to start with the client api:
const myClient = username : 'John';myClient;// listen for some eventsmyClientmyClient
App API
Here's how to start with the app api:
const myApp = name : 'My cool app';myApp;// listen for some eventsmyAppmyAppmyApp
Server
For the server, you will need a remote-stack-server.config.js
file at the root of your project.
See the remote-stack-server.config.js file reference
moduleexports = // server port port : 3030 // debug debug : true // max rooms that can be created (-1 = no limit) maxRooms : -1 // allow new rooms or not allowNewRooms : true // allow of not to override some of the default room settings // when create one from the front app side allowSettingsOverride : 'sessionDuration' // specify a room id pattern to follow (optional) newRoomIdPattern : null // default room settings defaultNewRoomSettings : maxClients : 10 pickedTimeout : 10000 sessionDuration : 10000 endSessionNotificationTimeout : 5000 averageSessionDuration : -1 // rooms rooms : id : 'cool-room' name : 'My cool room' simultaneous : 2 pickedTimeout : 10000 averageSessionDuration : 20000 // ssl certificate // { // key : path-to-key // cert : path-to-cert // passphrase : 'something' // } sslCertificate : false
Then, add a script into your package.json
file like so:
"scripts": "server": "coffeekraken-remote-stack-server"
And finaly, launch your server like so:
npm run server
CLI
This package expose a simple CLI that you can use to start the server.
coffeekraken-remote-stack-server [options]
Arguments
-p --port
: The port on which the server will run. Default 3030-c --config
: A path to a config file to load. Default ./remote-stack-server.config.js
Contribute
This is an open source project and will ever be! You are more that welcomed to contribute to his development and make it more awesome every day. To do so, you have several possibilities:
Who are Coffeekraken
We try to be some cool guys that build some cool tools to make our (and yours hopefully) every day life better.
More on who we are
License
The code is available under the MIT license. This mean that you can use, modify, or do whatever you want with it. This mean also that it is shipped to you for free, so don't be a hater and if you find some issues, etc... feel free to contribute instead of sharing your frustrations on social networks like an asshole...