title: How to establish connection for socket io and graphql?
body: <p>I am very new to graphql... here is my server file... I not being able to establish the socket io connection ...
  when I do console inside socket io it does not go inside the function... I think I am doing something wrong here <code>const io = require('socket.io')(server)</code>... </p>
  
  <pre><code>var express = require('express');
  var graphqlHTTP = require('express-graphql');
  var {schema} = require('../graphql/schema');
  var {root} = require('../graphql/resolver');
  
  const EventEmitter = require('events');
  var app = express();
  var server = require('http').Server(app);
  const event = new EventEmitter()
  const io = require('socket.io')(server)
  event.on('event', function(action) {
    console.log(action)
    io.on('connection', function (socket) {
      console.log('socket')
      socket.emit('action', action)
    })
  })
  
  app.use('/graphql', graphqlHTTP({
    schema: schema,
    rootValue: root,
    graphiql: true,
    formatError(err) {
      return {
        message: err.message
      };
    }
  }));
  app.use('/voyager', middleware({ endpointUrl: '/graphql' }));
  app.listen(3019);
  </code></pre>