Git Product home page Git Product logo

php-apns's Introduction

Hi there ๐Ÿ‘‹ I am Mayur Baldha !

  • ๐Ÿ”ญ Iโ€™m currently working on Javascript,TypeScript,ECMAScript Node.js,Express.js, Python...
  • ๐ŸŒฑ Iโ€™m currently learning new technogloies...
  • ๐Ÿ‘ฏ Iโ€™m looking to collaborate on opensource...
  • ๐Ÿค” Iโ€™m looking for help with scaling distributed systems and algorithms...
  • ๐Ÿ’ฌ Ask me about Technicals related to codes...
  • ๐Ÿ“ซ How to reach me: https://twitter.com/mayurbaldha91
About Me
  • JavaScript developer specializing in React, React Native, Node.js, Redux, and TypeScript by following Clean Architecture with SOLID principles.

  • From coding UI components to coding architectures and then to planning and training people to build architectures, in this process, I learned how important the teamwork is to build an IT product.

  • I have also done some notable work with technolgies using Node.js Python and Java technologies.

  • Self-motivated Team worker with excellent proactive problem-solving skills.

  • I am always eager to learn new things and try to improve my skills on a day-to-day basis.

  • I am happy to connect, since Resource is the only thing never too much!

  • Open to new challenges

php-apns's People

Watchers

 avatar

php-apns's Issues

Process::kil() not killing service process properly

What steps will reproduce the problem?
1. sending a message
2. waiting for the PushMonitor to kill the service process


What is the expected output? What do you see instead?
Expect the service process to be killed, instead app just hangs


What version of the product are you using? On what operating system?
Debian 

Please provide any additional information below.

I suspect the code in process::kill() which seems to have been copied from the 
PHP docs doesn't get the child process IDs from the 
parent PID correctly.

The line :

$pids = preg_split('/\s+/', `ps -o pid --no-heading --ppid $ppid`);

makes no sense to me as the preg split should surely be on the output of the 
command 'ps -o pid --no-heading --ppid $ppid' not the 
command line itself.

Is there a reason we need to find child PIDs? From what I can see the 
PushService.php file doesnt open any child processes.

Ive replaced the function with the following code which works for me:

    public function kill()
    {
        global $debug;

        $status = proc_get_status($this->pointer);

        print_r($status);

        if($status['running'])
        {
            if($debug)
                echo 'proc is running...closing pipes.';

            fclose($this->pipes[0]);
            fclose($this->pipes[1]);
            fclose($this->pipes[2]);

            $ppid = $status['pid'];         

            proc_terminate($this->pointer);

            return (proc_close($this->pointer) == 0);
        }
         }


I'm not sure if I need the proc_close condition on return.



Original issue reported on code.google.com by [email protected] on 28 Aug 2009 at 11:54

Explain how to use

In the readme it says "To send messages, just add them to the queue!"

What does this mean??? What php do we include and a code snippet would be
handy. I can't see any function like add to queue in any of the code :-(

Original issue reported on code.google.com by [email protected] on 23 Jun 2009 at 9:09

Requirements

The following PHP packages seem to also be required and they don't
necessarily install be default on all systems:
1) php-openssl
2) php-sockets

I think they should be added to the "Requirements" section of the README file

Original issue reported on code.google.com by [email protected] on 3 Nov 2009 at 3:19

PushService not detecting fwrite failure

What steps will reproduce the problem?
1. Send a successful push notification
2. Far end closes socket or socket becomes unusable
3. Try to send another Push notification and fwrite to the socket fails

What is the expected output? What do you see instead?

The fwrite error needs to be caught and a retry on another socket attempted..

What version of the product are you using? On what operating system?
Centos 5.3

Please provide any additional information below.

We were noticing the service hanging.
We solved this partly by adding the following to catch the socket fwrite
error in PushService.php. This now catches 75% of the hangs - there is
still another hang out there which we havent solved yet - we suspect
SendNotification is waiting for ever for a response to the fwrite:-

//Catch fwrite error in SendNotification
function sendNotification($deviceToken, $message)
{
//added catch fwrite error
$apnsMessage = chr(0) . chr(0) . chr(32) . pack('H*', str_replace(' ', '',
$deviceToken)) . chr(0) . chr(strlen($message)) . $message;
$fwritten=fwrite($this->apnsConnection, $apnsMessage);
if ($fwritten==0 || $fwritten===FALSE || $fwritten < strlen($apnsMessage))
    {
    error_log(date('Y-m-d H:i')." - fwrite failed:\n".$message."\nTo device:
".$deviceToken."\n return = ".$fwritten."\n", 3, 'PushServiceError.log');
    return -1;
   }
return $fwritten;
}

//Spot the send failure in listenForClients()
function listenForClients()
    {
        $this->serviceConnection = socket_create(AF_INET, SOCK_STREAM, SOL_TCP);
        socket_bind($this->serviceConnection, $this->serviceHost,
$this->servicePort);
        socket_listen($this->serviceConnection, 10);

        echo 'LISTENING ',$this->servicePort,"\n";

        while($clientSocket = socket_accept($this->serviceConnection))
        {
            socket_write($clientSocket, "OK\n");

            $deviceToken = trim(socket_read($clientSocket, 1024, PHP_NORMAL_READ));
            $message = trim(socket_read($clientSocket, 1024, PHP_NORMAL_READ));

            if(!empty($deviceToken) && !empty($message))
            {
                //SB added catch fwrite error
                if ($this->sendNotification($deviceToken, $message) >= 0)
                {
                    socket_write($clientSocket, "SENT\n");
                }
                else
                {
                    socket_write($clientSocket, "ERROR\n");
                }
            }
            else
            {
                socket_write($clientSocket, "ERROR\n");
            }
            socket_close($clientSocket);
        }
    }


Original issue reported on code.google.com by [email protected] on 20 Oct 2009 at 8:49

Error while starting child process

Whenever PushMonitor.php gets a message from the queue, it gives me this error 
"Error while 
starting child process"

I've followed the installation instructions.

My specs:
PHP 5.2.6 running on CentOS release 5.2 (Final) on my MediaTemple VPS

Any suggestions?

Original issue reported on code.google.com by [email protected] on 27 Jun 2009 at 1:02

Memory Leak

PushMonitor will consume up to whatever "memory_limit" is set to in php.ini and 
then become unresponsive and need a restart. The reason for this is the call to 
create_function() in the loop on line 89 of PushMonitor.php. I added the 
equivalent function to the code and the memory leak went away.

Seams like this is expected with create_function()
https://bugs.php.net/bug.php?id=6333

"[2000-09-07 11:43 UTC] [email protected]
This isn't a bug but how it works. Each create_function() call creates a new 
unique function. So obviously if you define zillions in an infinite loop you'll 
run out of memory."


Thank you so much for making this code available. It works extremely well. I'm 
able to send an average of 1.5 million push notifications a day on very modest 
hardware.

Thanks,

Darren

Original issue reported on code.google.com by [email protected] on 21 Aug 2011 at 4:49

Use of PHP_NORMAL_READ not compatible with PHP 5.2.9 apparantly.

The use of PHP_NORMAL_READ in PushService.php appears to cause PushService.php 
to work 
incorrectly under PHP 5.2.9 closing the connection after the token is sent (and 
not waiting for the 
message)

Changing these lines to the following;

$deviceToken = trim(socket_read($clientSocket, 1024));
$message = trim(socket_read($clientSocket, 1024));

Omitting the PHP_NORMAL_READ appears to have corrected this

Original issue reported on code.google.com by [email protected] on 24 Jun 2009 at 10:13

Start on boot

Hi, I know it's not really a problem with php-apns but I am having trouble 
getting the script to 
start automatically when my server boots. 

If I enter the startup commands manually everything works as it should. 
I've tried creating an init.d script but it does not work. 

Which user should be starting memcache & pushmonitor.php? Should they both be 
root?

Do they need to be called after apache starts? 

A tutorial on how to accomplish this would be greatly appreciated. 
I'm on the latest version of ubuntu on slicehost. 

Thanks,
Jim

Original issue reported on code.google.com by [email protected] on 27 Jul 2009 at 11:45

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.