Giter VIP home page Giter VIP logo

hprose-workerman's Introduction

Hprose and Workerman - work together!

Workerman is a framework for building multi-process servers in PHP. It allows you to build a Webserver or another kind of server - maybe for an API. Hprose is both, a protocol and RPC engine. It is modern, lightweight and amazingly fast. It's own serialization format supports objects, binary data and even more!

Introduction to Hprose

Hprose is a High Performance Remote Object Service Engine.

It is a modern, lightweight, cross-language, cross-platform, object-oriented, high performance, remote dynamic communication middleware. It is not only easy to use, but powerful. You just need a little time to learn, then you can use it to easily construct cross language cross platform distributed application system.

Hprose supports many programming languages, for example:

  • AAuto Quicker
  • ActionScript
  • ASP
  • C++
  • Dart
  • Delphi/Free Pascal
  • dotNET(C#, Visual Basic...)
  • Golang
  • Java
  • JavaScript
  • Node.js
  • Objective-C
  • Perl
  • PHP
  • Python
  • Ruby
  • ...

Through Hprose, You can conveniently and efficiently intercommunicate between those programming languages.

Usage

In order to use Hprose with a Workerman setup, you will need to have Composer. With it, the required dependencies are installed.

Example: Create a Hprose-based workerman setup

<?php
# Standalone
require_once "Workerman/Autoloader.php";
require_once "Hprose.php"; # If you run the native PECL extension, you won't need this.

# Using composer
require_once "vendor/autoload.php";

// Create the worker
$host = "127.0.0.1";
$port = 9999;
$worker = new \Workerman\Hprose($host, $port);
// Set options
$worker->count = 4;
$worker->reloadable = true;

// Add a function
function hello($w) { return "Hello, $w!"; }
$hprose = $worker->hprose();
$hprose->addFunction("hello");

// Start the Workerman framework, run the worker(s)...
\Workerman\Worker::runAll();

You now have a Workerman instance with 4 workers listening on your local port 9999. This server balances requests upon processes and lets you scale your application.

Note

hprose-php and hprose-pecl do not currently have methods to interact with a TCP server. You will need to use NodeJS or another supported language to talk to this server instance.

For further information, please consult the hprose-php and/or hprose-pecl repositories.

License

This code is released by the standard MIT license.

Author

This little module was coded by Kevin Ingwersen (Ingwie Phoenix) Hprose was originally developed by Ma Bingyao

hprose-workerman's People

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.