   # using postMessage
   #
   # Returns a String of the Message's UUID
-  _dispatch: (method, data) ->
-    uuid = @_generateUuid()
-
+  _dispatch: (uuid, method, data) ->
     payload = @_payload(uuid, method, data)
     @_frame.postMessage payload, '*'
     uuid

      do (endpoint) =>
        @[endpoint] = (args...) ->
          [data, callback] = @_parseArgs(args)
          uuid = @_dispatch(endpoint, data)
          @_registerCallback(uuid, callback) if callback?

    @

  # Take an artibuarty number of arguments and determine which is the data and

  # Returns nothing
  ready: (callback) ->
    @_createFrame @serverUrl, =>
      uuid = @_generateUuid()
      @_dispatch(uuid, 'getEndpoints', true)

      @_registerCallback uuid, (methods) =>
        @_createEndpoints(methods)
