
/*
 * Copyright 2017-present Open Networking Foundation

 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at

 * http://www.apache.org/licenses/LICENSE-2.0

 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */


(function () {
  'use strict';

  const clients = require('./clients.js');
  const logger = require('../config/logger.js');

  let io;

  exports.create = function(server) {
    // INSTANTIATE SOCKET.IO
    // =============================================================================

    io = require('socket.io').listen(server);

    // LISTEN TO "CONNECTION" EVENT (FROM SOCKET.IO)
    // =============================================================================

    io.on('connection', function (socket) {
      logger.log('debug', 'connect %j', socket.handshake.query);
      clients.add(socket.handshake.query);

      socket.emit('connected', {message : 'Welcome to XOS'});

      socket.on('disconnect', function(reason) {
        clients.remove(socket.handshake.query);
        logger.log('debug', 'disconnect %s %j', reason, socket.handshake.query);
      });
    });

  };

  exports.get = () => io;

  // USAGE
  // const socketIo = require('./controllers/websocket.js');
  // const socket = socketIo.get();
  // socket.emit('eventName', data);

})(); 