Reload .tid from disc without rebooting Node server?

156 views
Skip to first unread message

Ben H.

unread,
Sep 1, 2015, 12:50:51 PM9/1/15
to TiddlyWiki
Is there a faster way to load changed tiddlers from disc into the browser without restarting the Node server?

Best of all would be a way to have the server monitor for changes to files on disc and push those changes to the browser, but I don't see anything in the code for that.

Danielo Rodríguez

unread,
Sep 1, 2015, 1:11:33 PM9/1/15
to TiddlyWiki
Not yet. A re-writing of the sync module would be needed for that

Ben H.

unread,
Sep 1, 2015, 1:53:47 PM9/1/15
to TiddlyWiki
Dang. Is there any functionality to push changed tiddlers from server to client?

Jeremy Ruston

unread,
Sep 1, 2015, 2:07:21 PM9/1/15
to TiddlyWiki
Hi Ben

On Tue, Sep 1, 2015 at 6:53 PM, Ben H. <moog...@gmail.com> wrote:
Dang. Is there any functionality to push changed tiddlers from server to client?

This is an area that needs working on. Part of it, as Danielo mentioned, is a new file system sync adaptor that can watch for changes in the file system and respond to them. For pushing changes from the server to the browser, I'm a fan of Server Sent Events, much simpler than the more popular sockets:


The file system adaptor is a nice self contained area for somebody else to work on, if you're interested.

Best wishes

Jeremy.
 

--
You received this message because you are subscribed to the Google Groups "TiddlyWiki" group.
To unsubscribe from this group and stop receiving emails from it, send an email to tiddlywiki+...@googlegroups.com.
To post to this group, send email to tiddl...@googlegroups.com.
Visit this group at http://groups.google.com/group/tiddlywiki.
To view this discussion on the web visit https://groups.google.com/d/msgid/tiddlywiki/0f0bc4af-1a9f-4da8-9da0-879322fcc93e%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.



--
Jeremy Ruston
mailto:jeremy...@gmail.com

Ben H.

unread,
Sep 2, 2015, 4:23:57 PM9/2/15
to TiddlyWiki, jeremy...@gmail.com
Alright, I got fs.watch printing console messages anytime a file in the tiddlers directory changes. Problem is, fs.watch is reporting each change twice. node-watch seems to be what most people use instead of ns.watch directly, but is there a way to include a node module without forcing the user to install it manually alongside tiddlywiki?

Danielo Rodríguez

unread,
Sep 2, 2015, 4:42:32 PM9/2/15
to TiddlyWiki
I'm not sure what do you mean, since I don't know the modules you are mentioning. But, one of the strengths of TW is that it operates both on server and browser. So you can create a plugin that runs on the node side wrapping any node module of your choice.

Ben H.

unread,
Sep 2, 2015, 6:00:24 PM9/2/15
to TiddlyWiki
On Wednesday, September 2, 2015 at 1:42:32 PM UTC-7, Danielo Rodríguez wrote:
I'm not sure what do you mean, since I don't know the modules you are mentioning. But, one of the strengths of TW is that it operates both on server and browser. So you can create a plugin that runs on the node side wrapping any node module of your choice.

Eh, I didn't really want to turn it into a whole new plugin, just add it to the current filesystemadapter plugin. But fs.watch has finicky behavior, so most use a module to wrap it and make it behave. I didn't think it would be a great idea to introduce an external dependency to a plugin that ships with TW by default, but building an entire plugin around such a simple module just to extend an entirely different plugin seems like a complicated mess.

Any ideas?

Danielo Rodríguez

unread,
Sep 3, 2015, 10:51:36 AM9/3/15
to TiddlyWiki
Who said that it should be shipped by default with tiddlywiki? If you want to add new functionality you should do it through a plugin. Plugin does not mean complicated, it can just extend existing core methods and modules. Is fs.watch default node method?

BJ

unread,
Sep 3, 2015, 2:52:13 PM9/3/15
to TiddlyWiki
I think you need to use https://github.com/paulmillr/chokidar. I would suggest copying the existing sync adapter code - you can rename it as '$:/plugins/'me'/filesystem and have you own plugin or do a pull request to include your changes in the existing plugin

cheers
BJ
Reply all
Reply to author
Forward
0 new messages