{"action":"created","issue":{"url":"https://api.github.com/repos/mgp25/WhatsAPI-Official/issues/453","labels_url":"https://api.github.com/repos/mgp25/WhatsAPI-Official/issues/453/labels{/name}","comments_url":"https://api.github.com/repos/mgp25/WhatsAPI-Official/issues/453/comments","events_url":"https://api.github.com/repos/mgp25/WhatsAPI-Official/issues/453/events","html_url":"https://github.com/mgp25/WhatsAPI-Official/issues/453","id":59395850,"number":453,"title":"Missing messages","user":{"login":"moshere","id":7210322,"avatar_url":"https://avatars.githubusercontent.com/u/7210322?v=3","gravatar_id":"","url":"https://api.github.com/users/moshere","html_url":"https://github.com/moshere","followers_url":"https://api.github.com/users/moshere/followers","following_url":"https://api.github.com/users/moshere/following{/other_user}","gists_url":"https://api.github.com/users/moshere/gists{/gist_id}","starred_url":"https://api.github.com/users/moshere/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/moshere/subscriptions","organizations_url":"https://api.github.com/users/moshere/orgs","repos_url":"https://api.github.com/users/moshere/repos","events_url":"https://api.github.com/users/moshere/events{/privacy}","received_events_url":"https://api.github.com/users/moshere/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/mgp25/WhatsAPI-Official/labels/Outdated","name":"Outdated","color":"fbca04"}],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":5,"created_at":"2015-03-01T13:26:43Z","updated_at":"2015-03-01T15:30:27Z","closed_at":"2015-03-01T15:10:14Z","body":"Hi,\r\nI'm running the following code from command line.\r\nOnce command line to send messages (below) and the second to retrieve.\r\nI've lock file in order to make sure not to login and connect twice.\r\nHowever in most of the cases while sending and receiving several messages (~30) about 3 or 4 are missing. \r\nI get no error, just missing messages. I looked into it for a day now without identifying the issue.\r\nI really thank you if you can look into it and tell what's wrong.\r\n\r\nThank you in advance,\r\nMoshe\r\n\r\nSend messages:\r\n```php\r\n<?php\r\n\r\n// This file is part of a tutorial on the blog of Philipp C. Heckel, July 2013\r\n// http://blog.philippheckel.com/2013/07/07/send-whatsapp-messages-via-php-script-using-whatsapi/\r\n\r\nrequire_once('whatsapp_whatsapi_config.php');\r\n\r\n\r\n$w = new WhatsProt($userPhone, $userIdentity, $userName, $debug);\r\n$w->Connect();\r\n$w->LoginWithPassword($password);\r\n$w->sendMessage($argv[1], $argv[2]);\r\n$w->Disconnect();\r\n?>\r\n```\r\n\r\nReceive messages\r\n```php\r\n<?php\r\n\r\n\r\nrequire_once('whatsapp_whatsapi_config.php');\r\n\r\nfunction escapeJsonString($value) {\r\n    # list from www.json.org: (\\b backspace, \\f formfeed)    \r\n    $escapers =     array(\"\\\\\",     \"/\",   \"\\\"\",  \"\\n\",  \"\\r\",  \"\\t\", \"\\x08\", \"\\x0c\");\r\n    $replacements = array(\"\\\\\\\\\", \"\\\\/\", \"\\\\\\\"\", \"\\\\n\", \"\\\\r\", \"\\\\t\",  \"\\\\f\",  \"\\\\b\");\r\n    $result = str_replace($escapers, $replacements, $value);\r\n    return $result;\r\n  }\r\n\r\n$w = new WhatsProt($userPhone, $userIdentity, $userName, $debug);\r\n$w->Connect();\r\n$w->LoginWithPassword($password);\r\n \r\n\r\n    while ($w->pollMessage());\r\n    $msgs = $w->GetMessages();\r\n    foreach ($msgs as $m) {\r\n\t\t$from = str_replace(\"@s.whatsapp.net\", \"\", $m->getAttribute(\"from\"));\r\n\t\t$name = $m->getAttribute(\"notify\");\r\n\t\t$time = $m->getAttribute(\"t\");\r\n\t\tif($m->getChild(\"body\"))\r\n\t\t{\r\n        $messagebody = $m->getChild(\"body\")->getData();\r\n        $messagebody = escapeJsonString($messagebody);\r\n\t\t$from = escapeJsonString($from);\r\n\t\t$name = escapeJsonString($name);\r\n\t\t\r\n\t\t}\r\n\t\techo \"json: {\\\"from\\\":\\\"$from\\\", \\\"name\\\":\\\"$name\\\", \\\"time\\\":\\\"$time\\\", \\\"message\\\":\\\"$messagebody\\\"}\\n\";\r\n\t\t}\r\n\r\n$w->Disconnect();\r\n?>\r\n```"},"comment":{"url":"https://api.github.com/repos/mgp25/WhatsAPI-Official/issues/comments/76601856","html_url":"https://github.com/mgp25/WhatsAPI-Official/issues/453#issuecomment-76601856","issue_url":"https://api.github.com/repos/mgp25/WhatsAPI-Official/issues/453","id":76601856,"user":{"login":"mgp25","id":5390120,"avatar_url":"https://avatars.githubusercontent.com/u/5390120?v=3","gravatar_id":"","url":"https://api.github.com/users/mgp25","html_url":"https://github.com/mgp25","followers_url":"https://api.github.com/users/mgp25/followers","following_url":"https://api.github.com/users/mgp25/following{/other_user}","gists_url":"https://api.github.com/users/mgp25/gists{/gist_id}","starred_url":"https://api.github.com/users/mgp25/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mgp25/subscriptions","organizations_url":"https://api.github.com/users/mgp25/orgs","repos_url":"https://api.github.com/users/mgp25/repos","events_url":"https://api.github.com/users/mgp25/events{/privacy}","received_events_url":"https://api.github.com/users/mgp25/received_events","type":"User","site_admin":false},"created_at":"2015-03-01T15:30:26Z","updated_at":"2015-03-01T15:30:26Z","body":"@moshere you can store received messages, you can find all the info in the wiki\r\n\r\nRegards"}}