Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Your Real Time Web Playground
Python
branch: master

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.
static
templates
.gitignore
README.markdown
app.yaml
feedparser.py
main.py
markdown.py
models.py
settings.py.dist
templatefilters.py
webhooks.py
xmppbots.py

README.markdown

What is ReaTiWe?

Real Time Web (Rea-Ti-We) is your playground for all cool real-time-related stuff, which become popular recently:

The system have two main parts:

Features

  • Microblogging via web or via XMPP (@me {text} command)
  • XMPP messages between ReaTiWe users by nickname (@nick {text} command)
  • Comments on entries via web or via XMPP (#1234 {text} command)
  • A lot of /callback/{some_secret} valid PuSH subscribers - used for external feeds aggregation
  • /callback/{username}/atom URL is a valid PuSH topic - used by external aggregators for getting notifications from ReaTiWe

Getting started

Initial registration

Most of the system services are available only after sign in. For that, you need a Google account. After the sign in, go to the Settings page and fill your details:

  • Nickname - Used mostly via XMPP (messages etc.). Will also hide your real JID
  • Full name - Visible via web on all your entries.
  • JID - Add reatiwe@appspot.com to that account's roster
  • Secret - Used for JID validation (AUTH command)
  • TwitName - Used only for the avatars (service provided by http://img.tweetimag.es/ )
  • Subscriptions - list of topics, you are subscribed to. See below (PuSH section) for details.

Working with the bot

Test the connection with the bot:

ping

Validate your JID. If for example your settings are - JID: user@sample.com and secret: secret123 :

If you change your JID, you need to revalidate it.

Start microblogging, comment on entries, sending messages to other users:

@me This is just a small test microblog message
@dude hi, dude. I'm using ReaTiWe too
last   (will show everybody's last 10 entries)
#3214  (will show you entry with ID=3214)
like #3214 (likes this entry)
#3214 interesting stuff. this is my comment
mine   (will show your own last 10 entries)
off (no more messages coming)
on  (messages coming again)

You can disable messages from other users or announces for new feed entries with ON / OFF commands

Atom feeds

"Public timeline" Atom feed is on URL http://reatiwe.appspot.com/atom. There is also per user Atom feed, available on URL http://reatiwe.appspot.com/user/{username}/atom Both types of feeds have PuSH reference hub URL included:

<link rel="hub" href="https://pubsubhubbub.appspot.com/"/>

Webhooks and PubSubHubbub (PuSH)

Everytime some user is creating a new entry via web or XMPP, the system will ping PubSubHubbub reference hub with two topics:

If you want some external services to get real-time notifications from ReaTiWe, ask them to subscribe to that topics. If the external service is not getting your entries, you can try to ping the hub from the PuSH reference hub 'Publish' page. On the same page, you can check when was the last time, when the hub got your feed.

If you want to aggregate some external Atom feeds with your entries, go to the Settings page and enter the topic URL and (optional) the origin (some string, you want to see in the 'from ...' part of the entries). You can enter also some PuSH hub URL or use the default PuSH reference hub: "hub.mode"="subscribe", "hub.callback"="http://reatiwe.appspot.com/callback/{some_secret}"

ReaTiWe subscribtion handler is checking for 'hub.challenge' and 'hub.topic' parameters, via a GET request from the PuSH hub, and sending back 'hub.challenge' in the response body.

On POST requests, comming from the hub, only the valid Atom entries, which are still new for the system (checking atom entries IDs and links) are aggregated.

You can also subscribe/unsubscribe from the XMPP bot (commands follows):

list (show all your subscriptions)
sub http://somefeed.example.com/feed SomeFeed http://hub.com/  (origin='SomeFeed', 
                                                                hub='http://hub.com/')
unsub Xx12eW  (unsubscribe from topic with name=Xx12eW)

There is also an XMPP messages send webhook (POST requests), available on URL: http://reatiwe.appspot.com/send. You can use it to send XMPP messages via web (pure-man BOSH service ;) ) to ReaTiWe users. Needed parameters are as follows:

  • to - username, you want to send a message to
  • from - your username
  • secret - the secret from the Settings page
  • message - message text to send

Example code:

curl -X POST -d"to=other" -d"from=me" -d"secret=secret123" \
             -d"message=hello+world" http://reatiwe.appspot.com/send

Available XMPP commands

In order to use the ReaTiWe services via XMPP, you need to add reatiwe@appspot.com JID to your roster and eventualy accept the authorization request.

Commands, available for everybody

  • help, ? - available commands
  • ping - check the connection
  • auth {secret} - validate the current JID

Commands, available only after JID validation

In order to validate your current nick, you need to enter it on the Settings page. On the same page you can enter your secret too. By default a random secret will be generated, when you first login to the system. From your XMPP client send

AUTH {your secret here}

, where {your secret here} is the secret from the Settings page.

  • on / off - enable / disable messages from the system
  • @nick - send a message to another system user
  • @me {text} - post an entry
  • last - show last 10 entries from everybody
  • mine - show your own last 10 entries
  • #1234 - show some entry and comments to it, 1234 is an entry ID
  • #1234 {text} - comment on some entry, 1234 is an entry ID
  • like #1234 {text} - like an entry with ID=1234
  • list - list all topic subscriptions
  • sub {url} [alias] [hub] - subscribe to some topic (Atom feed) (alias is optional, default="feed")
  • unsub {name} - unsubscribe from some topic

Use cases

Something went wrong with that request. Please try again.