Coder Social home page Coder Social logo

priestd09 / pushman Goto Github PK

View Code? Open in Web Editor NEW

This project forked from pushmanphp/pushman

0.0 1.0 0.0 2.98 MB

Open source websocket event handler

License: MIT License

PHP 51.21% JavaScript 0.72% ApacheConf 0.11% Ruby 18.94% CSS 18.73% HTML 10.19% Shell 0.09%

pushman's Introduction

Pushman

Latest Stable Version Total Downloads Latest Unstable Version License

Pushman is an open source web socket event manager. It allows you to push events over HTTP to your own Pushman server which will push event information down to a client via a Web Socket.

You can bind server side events to client notifications.

Demo on the Pushman Website.

Todo for Version 3

Okay, testing is the next big thing. Thanks to laravel 5.1, I'll write up tests in PHPUnit!

  • Rewrite PushmanHandler -> Use Non-queued job instead of a class
  • General code cleanup (lots of mess around)
  • Make API endpoint for broadcasting to a specific client only.
  • Write for Pushman :) Integrate with travis-ci
  • Way better documentation for building your own Pushman.
    • Implement Swagger.io? Easy clean docs for the API.
  • Allow users to broadcast back to the server?

Long term todo list

  • Shad is working on a cool new User Interface
  • Build Pushman Lite as an independant Package to include in single sites.
  • Push console logs out on PushmanInternal Channel.

Official Documentation

Documentation for usage can be found on the Pushman website.

Documentation for building your own Pushman instance is found below.

Building your own Pushman Instance

Pushman works fantastically on Laravel's Forge! You still need to install prerequisites though.

PHP Extensions

Pushman requires ZeroMQ which is a custom binary (Windows and Linux), along with it's PHP extension.

You can follow zmq's installation instructions, but you should know building it for a Forge server is easy.

Step 1 - Install the Binary

When installing on Windows, you can just install the .exe from their website.

For Debian based systems, there is an apt package: apt-get install libzmq3-dev

ZeroMQ Download

Step 2 - Install the PHP Extension

You can always build the PHP extension yourself:

git clone git://github.com/mkoppanen/php-zmq.git
$ cd php-zmq
phpize && ./configure
$ sudo make
$ sudo make install

When building the extension for Windows, you can just download an existing .dll file from their website and place it in the php /ext directory. You will also need to add the extension=zmq.dll to your php.ini file.

PHP Extension Download

Port Requirements

Pushman requires two ports to function, an INTERNAL and a PUBLIC port, the public port handles websocket connections and the other handles incoming API requests.

By default both of these ports are configurable in the .env file in the root directory or by setting an environment variable. You only need to setup a firewall rule for the PUBLIC port, but do ensure both ports are free to bind to.

.env file:

PUSHMAN_PORT=8080
PUSHMAN_INTERNAL=5555

Installing the Code

On forge, you can just build a new site, and give the it the Github repo to install itself. Duffleman/pushman on the master branch is what you need to enter.

On a regular server, git clone the directory and run composer install --no-dev to install the requirements.

Configuration

Pushman requires a database, so for both Forge and a regular server, enter your Database editor of choice, or sqlite, and build a database and enter the details in the .env file in the root web directory.

Once the database configuration is set, you can run php artisan migrate followed by php artisan key:generate to publish the database layout. Or on Forge, just redeploy the site.

You MUST set an App Key.

You may also need to run chmod -R 777 storage/ to grant write permissions on your storage folder. You may also need to run chmod -R 777 bootstrap/cache to grant write permissions on the cache directory.

Runtime

Pushman itself can then be run by using php artisan pushman:run. I highly recommend setting up a supervisord task for this or in Forge, go into your server tab and enter the full path to artisan and Forge will auto monitor the task for you.

Example Command

php /home/forge/pushman.dfl.mn/artisan pushman:run

Security Vulnerabilities

If you discover a security vulnerability within Pushman, please send an e-mail to George Miller at [email protected]. All security vulnerabilities will be promptly addressed.

License

Pushman is open-sourced software licensed under the MIT license

Thinking out load

Payload Pushing

Currently we use a TOKEN in the URL string to see if the user is authorized to connect. Could we find a better way to push data to the server, things like a unique ID identifying them as a user perhaps?

After that, we can allow an API to /api/listeners or something which returns the listeners of a channel, the events they listen to, and any of that data. Then we allow an API point for /api/whisper which broadcasts back to a specific user only.

pushman's People

Contributors

johnhaldson avatar stockhausen avatar

Watchers

 avatar

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.