Thanks Jeremy - Actually I did some experiments
I set up a relay server to log all messages between
the Tiddly wiki and the node backend. This is what happened
(Messages always start from the TW - these are the HTTP messages involved)
1) "OPTIONS /"
response 404 Not found
(I had to look up what OPTIONS means - it expects a response something
like Allow: OPTIONS, HEAD, GET, POST)
2) Server closes socket
3) "GET /"
Reply is 200 OK with chunked transfer encoding and a keep alive connection
then we get about 6MBytes of text/html
(I have a question about this response at the end of this mail)
4) "GET /status"
Response is a JSON term
{space:{recipe:default},tiddlywiki_version:"5.1.15"}
5) Server closes socket
6) "HEAD /"
response 404 Not found
7) GET /recipes/default/tiddlers.json
Now we get a JSON term with a long list of tidders back
8) PUT /recipes/default/tiddlers/%24%3A%2FStoryList
Data is a JSON story list
Response 204 OK
9) Server closes socket
The I did some things in the browser
10) PUT /recipes/default/tiddlers/%24%3A%2FStoryList
Data is a JSON story list
Response 204 OK
11) Server closes socket
I did a write in the browser
12) PUT /recipes/default/tiddlers/Draft%20of%20'ProofOfWork
Data JSON
Other messages include
DELETE /bags/default/tiddlers/Draft%20of%20'ProofOfWork'
PUT /recipes/default/tiddlers/ProofOfWork
data JSON
Enough tracing ...
Comments (and questions)
To make a back-end I need to convert the JSON form of the GETs and PUTs into
a suitable file format.
The tidder ProofOfWork in a file looks like this:
---
created: 20180219090531165
modified: 20180219090536326
tags: Silly
title: ProofOfWork
type: text/vnd.tiddlywiki
Energy efficiency is appalling oh
This is slightly different from the JSON term that created the file
The term was
{created: "20180219090531165",
text: "Energy efficiency is appalling oh",
bag: "default",
revision: "0",
type: "text/vnd.tiddlywiki",
title: "ProofOfWork",
tags: ["Silly"],
modified: "20180219090535217"}
So the backend has thrown away the bag and revision tags.
The only biggish problem in making a backend is the response to the first
message (the one that results in 6MB of stuff)
Somehow the backend has created a huge page from the data in the file
system.
Is the relationship between the data in the file system and HTML that gets
sent to the browser simple? - ie just the concatenation of a bundle of files
or has the backend done some heavy lifting to make the HTML page?
Cheers
/Joe
On Monday, 19 February 2018 00:02:00 UTC+1, Jeremy Ruston wrote:
>
> Hi Joe
>
> I'm running the node backend downloaded from
> https://github.com/Jermolene/TiddlyWiki5
> and was wondering exactly what the protocol between the browser and
> backend was.
>
>
> The TW5 client (contained in the plugin $:/plugins/tiddlywiki/tiddlyweb)
> talks to the server with the TiddlyWeb API, a flexible API for putting
> tiddlers on the web. It was originally developed for TiddlyWiki Classic,
> and is documented at http://tiddlyweb.com/.
>
> The TW5 server (contained in the core plugin) supports a bare minimum of
> the TiddlyWeb API for personal use.
>
> At a guess it's JSON over HTTP (I might be wrong) - is the protocol
> *specified* somewhere
> or do I have to read the code (if so where?)
>
>
> It is indeed a traditional RESTesque JSON over HTTP interface.
>
> The client end of the TW5 implementation is here:
>
>
> https://github.com/Jermolene/TiddlyWiki5/blob/master/plugins/tiddlywiki/tiddlyweb/tiddlywebadaptor.js
>
> And the server end is here:
>
>
> https://github.com/Jermolene/TiddlyWiki5/blob/master/core/modules/commands/server.js
>
> Is there a way of tracing and dumping to a file all the messages between
> the browser and node
> so I can see exactly what is happening?
>
>
> Using the browser developer tools “Network” tab gives an excellent insight
> into what is going on.
>
> Best wishes
>
> Jeremy.
>
>
> Cheers
>
> /Joe
>
>
>
> --
> You received this message because you are subscribed to the Google Groups
> "TiddlyWikiDev" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected] <javascript:>.
> To post to this group, send email to [email protected]
> <javascript:>.
> Visit this group at https://groups.google.com/group/tiddlywikidev.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/tiddlywikidev/3214cda4-fcc3-478c-afc1-01be9b5fb359%40googlegroups.com
>
> <https://groups.google.com/d/msgid/tiddlywikidev/3214cda4-fcc3-478c-afc1-01be9b5fb359%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
> For more options, visit https://groups.google.com/d/optout.
>
>
>
--
You received this message because you are subscribed to the Google Groups
"TiddlyWikiDev" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/tiddlywikidev.
To view this discussion on the web visit
https://groups.google.com/d/msgid/tiddlywikidev/9f77c396-1772-40d1-99ea-d92c97e6ef78%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.