Coordinated Viewing

We consider what we have and what we might want for coordinating between independent applications.

# Controlled

Wiki can select a page as active and scroll so that it is visible in the lineup.

Wiki can select an item by id and scroll all pages containing that id to make the item visible.

Txtzyme can relay events to plugins that listen.

Any page can open wiki in an iframe and send messages to a plugin it contains to do things.

todo

# Controlling

Transport posts to a remote site.

Html forms can post to a remote site.

Txtzyme can signal through websockets.

Plugin to remote control another app.

todo

Core client app events to remote app control.

# Experiment

We created the Popup plugin that establishes a two-way connection with a new tab that it opens. github

The 'doit' function registers buttons and handlers for sending and receiving button presses.

doit 'world', send: -> 'everyone' rcve: -> $item.append "<p>hello world</p>" doit 'append-last', send: -> $('.page:last').attr('id') rcve: (data) -> wiki.doInternalLink data doit 'replace-last', send: -> $('.page:last').attr('id') rcve: (data) -> wiki.doInternalLink data, ...

We've tested cases where the sender sends the slug of the last lineup page to the receiving tab where it either appends or replaces the lineup there.

Once opened, both tabs can assume the role of sender or receiver. Should there be more than two tabs communicating a shared tab will reply to the most recent sender.

We send a structured payload as a serialized string as the data argument to postMessage received by the handler registered with addEventListener.

message = { type: "doit", doit: "append-last", data: "ward-cunningham" }

We do pick up some messages from Persona which seem harmless unless they don't parse as json. Eventually we will hide non-doit messages.

todo

Distinguish parent or child. Popup on emit could loop otherwise. Currently we discover parent when we receive their instruction.

Establish precedent for transmitting resolution context. Currently we send none (bad). Could send site. Better to send full resolution context and merge that with context available in the receiver.