Skip to content

Instantly share code, notes, and snippets.

@leedo
Created December 1, 2011 01:30
Show Gist options
  • Select an option

  • Save leedo/1412588 to your computer and use it in GitHub Desktop.

Select an option

Save leedo/1412588 to your computer and use it in GitHub Desktop.
sub add {
my ($self, $window_id, $message) = @_;
AnyEvent::HTTP::http_request
POST => "$self->{url}/buckets/$window_id",
body => encode_json($message),
headers => {
"x-riak-index-msgid_int" => $message->{msgid},
"x-riak-index-nick_bin" => lc $message->{nick},
"x-riak-index-timestamp_int" => $message->{timestamp},
},
sub {
my ($body, $headers) = @_;
if ($headers->{Status} != 200) {
warn $body;
}
};
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment