zmq

ZeroMQ bindings for ReactPHP.

  • 所有者: friends-of-reactphp/zmq
  • 平台:
  • 許可證: MIT License
  • 分類:
  • 主題:
  • 喜歡:
    0
      比較:

Github星跟蹤圖

React/ZMQ

ZeroMQ bindings for React.

Build Status

Install

The recommended way to install react/zmq is through composer.

composer require react/zmq

Example

And don't forget to autoload:

<?php
require 'vendor/autoload.php';

Here is an example of a push socket:

<?php

$loop = React\EventLoop\Factory::create();

$context = new React\ZMQ\Context($loop);

$push = $context->getSocket(ZMQ::SOCKET_PUSH);
$push->connect('tcp://127.0.0.1:5555');

$i = 0;
$loop->addPeriodicTimer(1, function () use (&$i, $push) {
    $i++;
    echo "sending $i\n";
    $push->send($i);
});

$loop->run();

And the pull socket that goes with it:

<?php

$loop = React\EventLoop\Factory::create();

$context = new React\ZMQ\Context($loop);

$pull = $context->getSocket(ZMQ::SOCKET_PULL);
$pull->bind('tcp://127.0.0.1:5555');

$pull->on('error', function ($e) {
    var_dump($e->getMessage());
});

$pull->on('message', function ($msg) {
    echo "Received: $msg\n";
});

$loop->run();

Todo

  • Integration tests
  • Buffer limiting
  • Do not push messages if no listener

Tests

To run the test suite, you need PHPUnit.

$ phpunit

License

MIT, see LICENSE.

主要指標

概覽
名稱與所有者friends-of-reactphp/zmq
主編程語言PHP
編程語言PHP (語言數: 1)
平台
許可證MIT License
所有者活动
創建於2012-05-26 22:23:33
推送於2018-05-18 15:28:48
最后一次提交2018-05-18 17:27:55
發布數5
最新版本名稱v0.4.0 (發布於 2018-05-18 17:28:24)
第一版名稱v0.1.0 (發布於 )
用户参与
星數249
關注者數19
派生數49
提交數119
已啟用問題?
問題數34
打開的問題數3
拉請求數22
打開的拉請求數0
關閉的拉請求數6
项目设置
已啟用Wiki?
已存檔?
是復刻?
已鎖定?
是鏡像?
是私有?