It's been a little while since I thought about it, and I may not be considering exactly the same use cases, but I'm pretty sure I'd do something vaguely like this:
Initiator of session holds authoritative file. Guest receives full file upon connection. Diffs are taken on each change (onkeypress event) ( for simple key mapping invariance (♥λ) ). Shoot the diffs over the wire, and apply the updates.
Something like that.