 
     client_diffsync: (socket, mesg) =>
         @is_active = true
+
         write_mesg = (event, obj) ->
             if not obj?
                 obj = {}
             obj.id = mesg.id
-            socket.write_mesg 'json', message['event'](obj)
+            socket.write_mesg 'json', message[event](obj)
 
         # Message from some client reporting new edits, thus initiating a sync.
         ds_client = @diffsync_clients[socket.id]

json = (out) -> misc.trunc(misc.to_json(out),512)

{ensure_containing_directory_exists, abspath} = misc_node

#####################################################################
# Generate the "secret_token" file as

            id               : @current_mesg_id
            edit_stack       : edit_stack
            last_version_ack : last_version_ack
        cb?()

    sync_ready: () =>
        @write_mesg('diffsync_ready')
