A node application using socket.io to update browsers with Tiddler activity on TiddlyWeb/Space
- node
- grunt:
npm install -g grunt-cli
- beanstalkd
- tsapp - if you want to run the example client.
Run npm install
then grunt --help
for a list of available project tasks.
The node application listens for incoming data from beanstalkd, so this should be running first. Then run:
node server/twsock.js
This will be running on localhost, ports 8080 and 8081. This is because some deployments of TiddlySpace cannot listen on port 8081 but 8080 is usually open.
In order to try out the server side code effectively, you will want to run a local instance of TiddlySpace. This is covered elsewhere. Additional steps beyond this are:
-
Install the dispatcher plugins:
pip install -U tiddlywebplugins.dispatcher pip install -U tiddlywebplugins.jsondispatcher
-
In tiddlywebconfig.py add the following:
'use_dispatcher': True, 'beanstalk.listeners': ['tiddlywebplugins.jsondispatcher'],
-
In one terminal run
twanager server
and in another runtwanager dispatcher
The example client expects an instance of TiddlySpace running against localhost on port 8000. Run the following:
grunt curl
cd client && tsapp serve
Then navigate to http://localhost:8082/index.html
If you are not running the server side code, you can change this to point to tiddlyspace.com by commenting out (#) the
target_server
line in the client/.tsapp
file.
Also replace localhost
with tiddlyspace.com
in client/index.html
:
<script src="http://localhost:8080/socket.io/socket.io.js"></script>
And this line in client/assets/ts-sockets.js
:
var socket = io.connect("http://localhost:8080");
Run:
grunt package
This produces a gzipped tarball that can be installed as follows:
grunt install
This installs twsock as a global application. It will be available in the path to run as twsock
.
Make sure localhost
references are replaced with the target server
(e.g. tiddlyspace.com). Also make sure target_server
is set correctly
in .tsapp
. Then (from the client
directory) run:
tsapp push <space>_public
Replace <space>
with the target space where the client-side code will
live. Remember, you cannot push to tiddlyspace without prior authentication. If you have not done so already:
tsapp auth