Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- var DeepstreamServer = require( 'deepstream.io' ),
- server = new DeepstreamServer();
- // Optionally you can specify some settings, a full list of which
- // can be found here //deepstream.io/docs/deepstream.html
- server.set( 'host', '10.2.2.95' );
- server.set( 'port', 6020 );
- server.set( 'tcpHost', '10.2.2.95' ); //, '0.0.0.0' );
- server.set( 'tcpPort', 6022 );
- // dump communcation data
- server.set( 'permissionHandler', {
- isValidUser: function( connectionData, authData, callback ) {
- console.log(JSON.stringify(connectionData,null,3));
- console.log();
- console.log(JSON.stringify(authData,null,3));
- if (authData.user == 'LisaA' && authData.password == 'sesame') {
- callback( null, authData.username || 'open' );
- return;
- }
- callback( "Ain't gonna happen" );
- },
- canPerformAction: function( username, message, callback ) {
- callback( null, true );
- },
- onClientDisconnect: function( username ){} // this one is optional
- });
- // start the server
- server.start();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement