-
Notifications
You must be signed in to change notification settings - Fork 13
Description
Hi there seems to be a problem when it comes to using Async im using your default example, and im getting some strange errors
$chatmessage = "Hello";
$api->api_request ('sendMessage', {
chat_id => $message->{'message'}{'chat'}{'id'},
text => $chatmessage
}, sub {
my ($ua, $tx) = @_;
die 'Something bad happened!' unless $tx->success;
say $tx->res->json->{ok} ? 'YAY!' : ':('; # Not production ready!
});
As you can see the PAYLOAD is being sent
PAYLOAD = [
"https://api.telegram.org/botXXXXXXXXX/sendMessage",
"json",
{
"chat_id" : 1XXXXXXXX,
"text" : "Hello"
}
]
But if i dump the $tx i see this error 'message' => 'Premature connection close'
$VAR1 = bless( {
'events' => {},
'res' => bless( {
'content' => bless( {
'headers' => bless( {
'headers' => {}
}, 'Mojo::Headers' ),
'events' => {
'read' => [
sub { "DUMMY" }
]
},
'read' => $VAR1->{'res'}{'content'}{'events'}{'read'}[0]
}, 'Mojo::Content::Single' ),
'error' => {
'message' => 'Premature connection close'
},
'state' => 'finished',
'finished' => 2,
'events' => {}
}, 'Mojo::Message::Response' ),
'completed' => 1,
'req' => bless( {
If i turn of async = 0 then the message gets thought.
Thanks
dexter