Advertisement
Guest User

Untitled

a guest
Mar 26th, 2016
75
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.03 KB | None | 0 0
  1. var DeepstreamServer = require( 'deepstream.io' ),
  2. server = new DeepstreamServer();
  3.  
  4. // Optionally you can specify some settings, a full list of which
  5. // can be found here //deepstream.io/docs/deepstream.html
  6. server.set( 'host', '10.2.2.95' );
  7. server.set( 'port', 6020 );
  8. server.set( 'tcpHost', '10.2.2.95' ); //, '0.0.0.0' );
  9. server.set( 'tcpPort', 6022 );
  10.  
  11. // dump communcation data
  12. server.set( 'permissionHandler', {
  13. isValidUser: function( connectionData, authData, callback ) {
  14. console.log(JSON.stringify(connectionData,null,3));
  15. console.log();
  16. console.log(JSON.stringify(authData,null,3));
  17.  
  18. if (authData.user == 'LisaA' && authData.password == 'sesame') {
  19. callback( null, authData.username || 'open' );
  20. return;
  21. }
  22. callback( "Ain't gonna happen" );
  23. },
  24.  
  25. canPerformAction: function( username, message, callback ) {
  26. callback( null, true );
  27. },
  28. onClientDisconnect: function( username ){} // this one is optional
  29. });
  30.  
  31. // start the server
  32. server.start();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement