Long-Polling Photo Stream
This long-polling
stream can be easily consumed using JavaScript in any modern browser. Photo upload
notifications are received when they happen, or as soon as your script finishes handling its
last notification.
Request Parameters
These parameters are set automatically by Meetup's must.js client.
- callback
- Name of a function to be called with an array of photo notification objects. If this
parameter is not supplied, the chunked stream is joined instead.
- event_id
- Limit notifications to a specific event id. Use alphanumeric ids for repeating events.
- since_count
- Request that some number of recent messages be sent immediately, if available. May not be specified in the same request as since_mtime.
- since_mtime
- Should be supplied for all but the first polling request, so that any missed notifications are can be sent in an immediate response
Response
Photo upload notification objects include these properties. This method's response is
an array of zero or more of these, while Meetup's JS client calls your callback function
with exactly one object.
- caption
-
Photo caption if available
- ctime
-
Created time in millisseconds since the epoch
- highres_link
-
URL for the original sized photo
- member
-
Member that uploaded the photo
- member_id
-
ID of the member
- name
-
Name of the member
- mtime
-
Last updated time in milliseconds since the epoch
- photo_album
-
Photo album this photo belongs to
- event
-
Event, when available, associated with the photo album
- id
- ID of the event
- name
- Name of event
- group
-
Group associated with photo album
- city
- Group city
- country
- Group country code
- group_lat
- Group latitude
- group_lon
- Group longitude
- group_topics
- Topics associated with this group
- id
- ID of group
- join_mode
- "open", "approval", or "closed"
- name
- Name of group
- state
- If in the US, the state of the group
- urlname
- Unique portion of group's URL, no slashes
- photo_album_id
-
ID for the photo album
- photo_id
-
ID of the photo
- photo_link
-
URL for the standard sized photo
- thumb_link
-
URL for the thumbail sized photo
Errors
- connection_limit
- the client IP has exceeded its maximum number of connections
Examples
Install the Meetup stream client with bower
$ bower install must
The HTML page below is empty until photos are inserted from the stream.
<html>
<head>
<script src="components/jquery/jquery.min.js"></script>
<script src="components/must/must.js"></script>
<script>
must.Photos(function(photo) {
$('#photos').prepend(
'<img src="' + photo.photo_link + '"/>'
);
});
</script>
</head>
<body>
<div id="photos" />
</body>
</html>
See picturethis in our stream github project
for a more advanced example.
WebSocket Photo Stream
For browsers that support it, WebSockets is a more
efficient alternative to the long-polling stream. This is a push only endpoint and will discard
any messages received from the client after the socket is open.
Because browser support for WebSockets is limited, we recommend that you consume this stream
through the must.js client, which can fallback to long-polling.
Request Parameters
The full url for this method is ws://stream.meetup.com/2/photos
- since_count
- Request that some number of recent messages be sent immediately, if available. May not be specified in the same request as since_mtime.
- since_mtime
- Return recent photos with an mtime greater then the supplied time, in millisends since the epoch
Response
This stream includes the same JSON notification objects as its long-polling
counterpart, one per WebSocket frame.
Errors
- connection_limit
- the client IP has exceeded its maximum number of connections
Examples
The long-polling stream examples will automatically use WebSockets, if available.
Chunked HTTP Photo Stream
This method serves photo notifications using
chunked encoding
to maintian a persistent connection with a client. The connection will only be
terminiated for server maintenance or a connection error. It is suitable for
low-level HTTP clients rather than web browsers.
Request Parameters
- since_count
- Request that some number of recent messages be sent immediately, if available. May not be specified in the same request as since_mtime.
- since_mtime
- Return recent photos with an mtime greater then the supplied time, in millisends since the epoch
Response
This stream includes the same JSON notification objects as its long-polling
counterpart. These are served one per HTTP chunk and terminated
by newlines.
Errors
- connection_limit
- the client IP has exceeded its maximum number of connections
Examples
Try out the photo stream on the command line
curl -i http://stream.meetup.com/2/photos