         else return result
   
   # Register socket.io handlers.
-  io.sockets.on 'connection', (socket) ->
+  io?.sockets.on 'connection', (socket) ->
     c = {}
     
     build_ctx = ->

  host = null
  port = 3000
  root_function = null

  for a in arguments
    switch typeof a

    fs.readFileSync p, 'utf8'

# Takes in a function and builds express/socket.io apps based on the rules contained in it.
zappa.app = (func,disable_io) ->
  context = {id: uuid(), zappa, express}
  
  context.root = path.dirname(module.parent.filename)
