-
Notifications
You must be signed in to change notification settings - Fork 87
Automatically pushing stream information to a web page
alecgorge edited this page Aug 4, 2012
·
1 revision
Using push_locations.yml
you can have stream messages automatically POST
ed to a URL. This is useful for languages like PHP which are not very good for reading streams of data.
Here is a sample push_locations.yml
:
locations:
- stream_name: chat
enabled: true
url: http://example.com/my/chat.php
- stream_name: console
enabled: true
url: http://example.com/my/console.php
Now chat.php
would receive POST requests with the following keys:
-
source
: the stream that the data came from -
count
: the number of stream messages that are being delivered on this push. This could be anything from 1 to 10000 or more because the messages are buffered for a few seconds before they are sent to make sure that your server doesn't get absolutely hammered -
messages[]
: an array of the stream messages. You would access these in PHP like this:$messages_array = $_POST['messages']
. Each item in the array will be a string of JSON that needs to be decoded withjson_decode($message, true)
.