Using socket.io in a different file than server

The gist of what I'm trying to do is emit an even from the server when a process is happening to the client, so that the client will show some kind of loading gif. I figured the best way of doing this would be to use socket.io since I'm already using it in the project.

I have the project built out over several different files, and the files that would emit the event for processing is in a different file than my server.js. I've tried passing the server obj and socket along to the file in question, but still cannot get it to fire an event.

What I've tried:

Its required in the function due to the way I passed the obj along.

server

module.exports.socket = function(socket, http){
 var  io      = require('socket.io')(http);

 io.of("/").on("connection",function(socket){
  console.log(socket);
 });
};

module.exports.socket = function(socket, http){
 var  io      = require('socket.io')(http);

 io.sockets.emit('message', { data: 'placedatahere'});
};

module.exports.socket = function(socket, http){
 var  io      = require('socket.io')(http);

 io.to(socket).emit('message', 'random message');
};


module.exports.socket = function(socket, http){
 var  io      = require('socket.io')(http);
 io.sockets.on('connection', function (socket) {
  socket.emit("event", "amganemit");
 });
};

Client

var socket      = io();

socket.on("connect", function(){
 socket.on("onStart", function(data){
  console.log("onstart");
 });
 socket.on("uploadEnd", function(data){
  console.log("onend");
 });
 socket.on("event", function(data){
  console.log("event");
 });
 socket.on("message", function(data){
  console.log("message");
 });
});