appeerjs-server

0.1.2 • Public • Published

AppeerJS Server

A simple signaling server built for appeerjs clients using Socket.io.

Getting Started

  1. Go to your project directory using your command line tool then install the project using npm.
npm install appeerjs-server
  1. Require appeer.js to your main server script.
var appeer = require('appeerjs-server');
  1. Setup the Socket.io and then instantiate the AppeerServer inside the connection event. Let's say the file name is server.js.
var app = express();
var fs = require('fs');

// Add your ssl certificates
var sslConf = {
  key: fs.readFileSync('server.key'),
  cert: fs.readFileSync('server.crt')
};

// Create an https server instance to listen to request
var server = require('https').createServer(sslConf, app);
var io = require('socket.io').listen(server);

// Middleware to get the custom id of the connecting user
io.use(appeer.getCustomIdMiddleware);
io.on('connection', function (socket) {
    console.log('A user has connected with socket id', socket.id);
    appeer.initListeners(io, socket, {
      debug: true // Set to true to show console logs and errors, defaults to false
    });
});
  1. Run the server, and you're good to go.
node server.js

Inspirations and Motivations

Credits

License

This project is licensed under the MIT License - see the [LICENSE] (https://github.com/TMJPEngineering/appeerjs-server/blob/master/LICENSE) file for details

TODO

  • [ ] Unit tests

Readme

Keywords

Package Sidebar

Install

npm i appeerjs-server

Weekly Downloads

1

Version

0.1.2

License

MIT

Last publish

Collaborators

  • jmsanpascual