zeromq

PHP WebSocket ZMQ - Chat Operation - Send data to specific user

江枫思渺然 提交于 2019-12-12 21:08:21
问题 im working on a PHP project based on Symfony 2.2.11 and I installed the socketo related to the following tutorial http://socketo.me/docs/install to make my chat script working. ServerCommand.php // Code of the command line that starts the WebSocket server $oLoop = Factory::create(); // Listen for the web server to make a ZeroMQ push after an ajax request $oContext = new Context($oLoop); $oPull = $oContext->getSocket(\ZMQ::SOCKET_PULL); // LET IT 127.0.0.1 $oPull->bind('tcp://127.0.0.1:5555');

ZMQ sockets with custom load-balancing

被刻印的时光 ゝ 提交于 2019-12-12 20:05:37
问题 I looked at ZMQ PUSH/PULL sockets and even though I quite like the simplicity (especially compared to custom fragmentation/ack I am implementing right now in a system over UDP sockets), I would like to have custom load balancing instead of the naive round-robin (I believe) that ZMQ PUSH/PULL sockets are using. I am new to ZQM and not sure how I can implement it using ZMQ sockets and if it's even possible at all. What I would ideally like is, the serving PUSH socket (or some other socket type)

Can I send() from one thread and recv() from another on the same ZeroMQ REQ/REP Socket?

霸气de小男生 提交于 2019-12-12 19:03:04
问题 As the documents say, ZMQ sockets are not thread-safe. So I assume the answer to the title is 'No'. Still, I can't figure out how to implement a non-blocking request-reply pattern using ZMQ: Specifically, the client has a main thread which goes on about its business processing messages from a (thread-safe) message queue. The messages come from various sources, such as network, timers, I/O etc. Occasionally the main thread wishes to send a request to a remote server, but it does not want to

ZeroMQ poll thread safety

為{幸葍}努か 提交于 2019-12-12 18:01:45
问题 I have a thread that is polling on a ZMQ Poller: poller.poll(timeout) This thread is also the one which receives and sends back messages over the sockets registered in the poller. Then I have another thread that may, eventually, create a new socket and register it for polling on input events: socket = context.socket(...) socket.bind/connect(...) poller.register(socket, zmq.POLLIN) Once the socket is registered, the latter thread will not touch it again. Is this safe? Update The answers

Boost: Serializing/De-serializing a custom C++ object passed over ZeroMQ pull socket

时光总嘲笑我的痴心妄想 提交于 2019-12-12 16:39:04
问题 Description: I have a C++ class named GenericMessage which simply holds an id and data as its members (See code snippet 1 below - GenericMessage.hxx). My intention is to serialize an instance of this class and send it via a ZeroMQ socket which implements the push pattern. The serialization and sending task has been implemented in class ZMQHandler (see sendToBE function) which is placed in a header file name ZMQHandler.hxx shown in the code snippet 2 below. This class is instantiated by TestFE

Multiprocessing vs gevent

百般思念 提交于 2019-12-12 11:35:34
问题 Currently I am using zeromq with pub-sub pattern, I have single worker to publish and many(8) subscriber (all will subscribe) to same pattern. Now I tried multiprocessing to spawn subscribers it works. I am missing few messages. Why I am using multiprocessing is to handle each message as it arrives and process them, every second publisher publishes 10 - 100 messages. In this case it is advised use multiprocessing or gevent ? 回答1: Multiprocessing will clearly have much higher memory overhead

Windows 下Go 开发 github.com/pebbe/zmq4 依赖 ZeroMQ 安装

假装没事ソ 提交于 2019-12-12 10:13:27
【推荐】2019 Java 开发者跳槽指南.pdf(吐血整理) >>> 在Windows环境下开发go程序的过程中,需要用到 github.com/pebbe/zmq4 ,依赖于ZeroMQ,但是在获取 zmq4 的时候失败了。 初期解决办法,参考的是这个链接的内容: https://studygolang.com/articles/1296 然而问题还是没解决。 后面看了下自己Windows环境下的是 Visual Studio 2015 ,然后到这里( https://zeromq.org/download/ )下载了 Visual Studio 14 2015 x64 ,将解压后的文件夹中的所有 .h 的文件(我看到的之后 zmq.h )拷贝到安装的 mingw 的 x86_64-w64-mingw32\include 目录下,然后再把 libzmq-v140-mt-4_3_2.dll 拷贝到 x86_64-w64-mingw32\lib 目录下,并重命名为 zmq.dll ,然后编译Go程序,编译通过。 总结:下载与自己 Windows位数 、 vs 版本 一致的 zmq 包,然后将包里的 .h 文件放到 mingw 的 include 文件夹下,把 libzmq-xx.dll 放到 mingw 的 lib 目录下并重命名为 zmq.dll . 来源: oschina 链接

How could I retrieve and store random UUID-s in ZeroMQ sockets?

让人想犯罪 __ 提交于 2019-12-12 10:08:07
问题 I need to communicate between multiple clients. When I try to run file (multiple terminals) I get same identity. So I let router socket to automatically set the UUID. But what I found I cannot use that identity to store at server for routing between multiple clients. How would I handle multiple clients IDs? I am trying to build an asynchronous Chat server. I am following an approach of each client with dealer socket connects to server ( ROUTER -type sockets ). Server then extract the clients

Python zeromq — Multiple Publishers To a Single Subscriber?

允我心安 提交于 2019-12-12 08:49:17
问题 I'd like to write a python script (call it parent ) that does the following: (1) defines a multi-dimensional numpy array (2) forks 10 different python scripts (call them children ). Each of them must be able to read the contents of the numpy array from (1) at any single point in time (as long as they are alive). (3) each of the child scripts will do it's own work ( children DO NOT share any info with each other) (4) at any point in time, the parent script must be able to accept messages from

ZeroMQ REQ-REP not working

*爱你&永不变心* 提交于 2019-12-12 06:39:25
问题 I'm trying to use ZeroMQ for data exchange between my programs. My system consists of two parts: client (REQ) written on C# and running on Windows and server (REP) written in C++ and running on linux ubuntu. The client sends a request, server catches it, processes and sends a reply. The reply is never delivered. In the minimal test case client and server simply sends empty messages, so the problem isn't in the message construction or processing code. If I change the roles, and run server on