function _receive(clientId, msgStr) {
        var msg = JSON.parse(msgStr),
            event = msg.method || "event",
            deferred;
        if (msg.id) {
            deferred = _responseDeferreds[msg.id];
            if (deferred) {
                delete _responseDeferreds[msg.id];
                if (msg.error) {
                    deferred.reject(msg);
                } else {
                    deferred.resolve(msg);
                }
            }
        } else if (msg.tagId) {
            var editor = EditorManager.getActiveEditor(),
                position = HTMLInstrumentation.getPositionFromTagId(editor, parseInt(msg.tagId, 10));
            if (position) {
                editor.setCursorPos(position.line, position.ch, true);
            }
        } else {
            // enrich received message with clientId
            msg.clientId = clientId;
            exports.trigger(event, msg);
        }
    }
@private
Handles a message received from the remote protocol handler via the transport.
If the message has an `id` field, it's assumed to be a response to a previous
request, and will be passed along to the original promise returned by `_send()`.
Otherwise, it's treated as an event and dispatched.
TODO: we should probably have a way of returning the results from all clients, not just the first?

@param {number} clientId ID of the client that sent the message
@param {string} msg The message that was sent, in JSON string format