Upload
imogen-snow
View
216
Download
0
Embed Size (px)
Citation preview
FF 12: Clients
A presentation by Robin Upton (2009-10-16)Latest version at www.altruists.org/ff12
Attribution – NonCommercial - ShareAlikewww.altruists.org
V1.0.0
http://www.altruists.org/ff11
Recommended Pre-requisite: FF11: Hooks
What is an F2F Client?
An F2F client is a piece of software designed as an interface for an F2F server.
This presentation details the default F2F client (coded in JS), to help developers of the other clients maintain compatibility.
HTTP(S)
If they communicate over the internet, HTTPS should be used.
F2F F2F ServerServer
F2F F2F ClientClient
F2F F2F ClientClient
F2F F2F ServerServer
Communication
Clients are connected to only one server at a time.The client uses AJAX to exchange the
XML messages detailed in /FF8.
Messages in either direction are wrapped in a <comm>:
http://www.altruists.org/ff8
<comm><message .../>...<message .../>
</comm>
DOM Sections
F2F Clients keep data in separate sections:
The client has 4 other, less important, sections: clipboard, drag-drop, event-log, traffic-log
ClientsideServerside
semantic(XML)
display(XHTML)
CalculationData
(Invisible)
User Interaction(Visible)
Oth
er F2F
So
ft- System
s
hooks/render`
User input
F2F Processing Overviewsemantic (XML) display (XHTML)server (XML)
<servicereq>
<clientreq>
<hookreq>
<displayreq>
Sent to server
Sent to server
XSLT, datastores & communications
XSLby namespace
XSLby namespace
XSLTby namespace
JS DOM manipulation
JSDOM manipulation
Sent to client
no processing JS operations &XSL transforms
no processing
no processing SVG imagesno processing<imagereq>
Request:
ClientsideServerside
<scriptreq> replaced by chunk of XML
replaced by chunk of XML
replaced by chunk of XML
<clientreq>
All requests send to the client are <clientreq>s.
http://www.altruists.org/ff8
The JS client supports:
thread-add, thread-edit, thread-deleteManaging Windows:
<clientreq function=”http://friend2friend.net/client/thread-add”/>
Miscellaneous:
Since they are hardcoded, each client has a fixed set.
alert, clipboard-clear, data-input, js-value-set, packet, param-set,receive, send
(This list is not yet fixed)
<imagereq>
Clients process an <imagereq> by requesting this resource by URI from their F2F soft-system:
http://www.altruists.org/ff11
<svg:svg>
ClientClient Soft-Soft-systemsystem
<svg:svg>
uri src
<imagereq function=”http://f2f.name/images/1” x=”24” y=”24”/>
The server returns a Scalable Vector Graphic (SVG) image, which is scaled as requested and included in the displayDOM.
<displayreq>
Clients process a <displayreq> by requesting this resource by URI from their F2F soft-system:
<displayreq function=”http://f2f.name/displays/etc”>...optional XML...
</displayreq>
ClientClientSoft-Soft-
systemsystem
uri src
The server returns an XSL stylesheet,which is applied to the <displayreq> item.
<hookreq>
Clients process a <hookreq> by requesting a list of handlers for this resource from their F2F soft-system:
The client picks <handler>(s) according to the namespace of the data
<hookreq function=”uri”>...XML element(s) required...</hookreq>
<handl
er>
<ha<h
ClientClientSoft-Soft-
systemsystem
hook uri src
handler-list
ClientClientSoft-Soft-
systemsystem
handler uri src
XSL handler
<handler>
Handlers are XSL transforms, which are applied to the contained data.
<scriptreq>
Clients process a <scriptreq> by requesting the corresponding XML script from their F2F soft-system:
<scriptreq function=”http://f2f.name/scripts/etc”/>
ClientClientSoft-systemSoft-system
uri src
This XMLreplaces the <scriptreq>.
Some XML
<servicereq>
Clients send a <servicereq> for processing at their F2F soft-system.
http://www.altruists.org/ff11
ClientClient Soft-Soft-systemsystem
<servicereq>...
<servicereq function=”http://f2f.name/some-service”>...
If marked this-return=“0”, the servicereq is then discarded,otherwise, it is kept as a placeholder for the returning data.
(XML results)
Clientside <servicereq> processing
When clients have sent a <servicereq> to their F2F soft-system...
...if marked this-return=“0”, the servicereq is discarded;
...else if marked this-render=“suspend”, no rendering is carried out until a response is received;
...else rendering continues as usual.
http://friend2friend.net/modules/dev/data-validator...
<servicereq xmlns="http://friend2friend.net/" function="http://friend2friend.net/modules/desktop/add”>
The render hook creates a visual display of the servicereq:
F2F Client Address Hierarchy
F2F client addresses locate the soft system they are connected to:
The particular service request is indicated by request:
server = ”http://f2f.example.com”
system = ”default”
request = ”23”
The thread attribute holds the security context and window id
thread = ”4.1”
The node attribute defines the DOM section {semantic,display}:
node = ”semantic”
The context differentiates them from the server (and one another):
context= ”client-123”
Receiving Incoming Messages
http://www.altruists.org/ff8
To motivate descriptive terms for messages, we use a metaphor:- Assume the highest point of a communication is always its source.
Downstream messages arrive unsolicited:(type= “down”, “send”, “send2”)
Upstream messages are replies to earlier downstream messages:(type= “term”, “return”)
The <message>s of a <comm>are processed separately, currently in order, though this policy may later be dropped.
Receiving Upstream Messages (Replies)
Messages of type “term” or “return” are replies (upstream), and need node, thread & sreq attributes to specify the originating call.
If these correspond to a waiting <servicereq>, the incoming data is added below (“return”) or used to replace (“term”) it,
causing the affected thread to be re-rendered.
Otherwise, the message is ignored.(Possibly a warning should be issued).
Receiving Downstream Messages
Messages of type “down” are new requests from the server. Therefore, they need no thread, node or request attributes.
These messages may only have <clientreq> children,which are processed in serial order by the client.
Other content is ignored (probably with a warning).
Summary
Recommended Follow-up: FF13: Modules
http://www.altruists.org/ff13
F2F clients are graphical interfaces to F2F servers.
F2F F2F ServerServer
F2F F2F ClientClient
The Semantic (XML) & Display (HTML) sections are separate.
The client understands a range of request items.
servicereq
displayreqimagereq
hookreq
scriptreq
clientreq