app.js.wss 675 B

12345678910111213141516171819202122232425262728293031
  1. var fs = require('fs');
  2. var pomelo = require('pomelo');
  3. /**
  4. * Init app for client.
  5. */
  6. var app = pomelo.createApp();
  7. app.set('name', '$');
  8. // app configuration
  9. app.configure('production|development', 'connector', function(){
  10. app.set('connectorConfig',
  11. {
  12. connector : pomelo.connectors.hybridconnector,
  13. heartbeat : 3,
  14. useDict : true,
  15. useProtobuf : true,
  16. ssl: {
  17. type: 'wss',
  18. key: fs.readFileSync('../shared/server.key'),
  19. cert: fs.readFileSync('../shared/server.crt')
  20. }
  21. });
  22. });
  23. // start app
  24. app.start();
  25. process.on('uncaughtException', function (err) {
  26. console.error(' Caught exception: ' + err.stack);
  27. });