--- a
+++ b/backend/ws/mobile.js
@@ -0,0 +1,56 @@
+'use strict';
+
+// var CONSTANTS = require('../lib/constants');
+var initialized = false;
+var NAMESPACE = '/mobileApp';
+var mobileNamespace;
+
+function init(dependencies) {
+ var logger = dependencies('logger');
+ var pubsub = dependencies('pubsub').global;
+ var io = dependencies('wsserver').io;
+
+ //console.log (io);
+
+ if (initialized) {
+ logger.warn('The contact notification service is already initialized');
+ return;
+ }
+
+ mobileNamespace = io.of(NAMESPACE);
+
+ //console.log ("@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@");
+ //console.log (mobileNamespace);
+
+ mobileNamespace.on('connection', function(socket) {
+ logger.info('New connection on ' + NAMESPACE);
+
+ setInterval(function(){
+ socket.emit('notification', { hello: 'world' });
+ },2000);
+
+ /*
+ setTimeout(function(){
+ console.log(io);
+ },5000);
+ */
+
+ socket.on('messages', function (data) {
+ console.log(data);
+ });
+
+ // socket.on('subscribe', function(bookId) {
+ // logger.info('Joining contact room', bookId);
+ // socket.join(bookId);
+ // });
+
+ // socket.on('unsubscribe', function(bookId) {
+ // logger.info('Leaving contact room', bookId);
+ // socket.leave(bookId);
+ // });
+ });
+
+ initialized = true;
+}
+
+module.exports.init = init;