草庐IT

EventMachine

全部标签

Ruby EventMachine 和函数

我正在使用合适的RedisEMgem(在我的例子中为“em-hiredis”)读取EventMachinereact器循环中的Redis集,并且必须检查某些Redis集是否包含级联中的成员。我的目标是获取不为空的集合的名称:require'eventmachine'require'em-hiredis'deffetch_queue@redis.scard('todo').callbackdo|scard_todo|ifscard_todo.zero?@redis.scard('failed_1').callbackdo|scard_failed_1|ifscard_failed_1.z

ruby - 如何在 websocket eventmachine 中断开 redis 客户端

我正在尝试构建一个websocket服务器,每个客户端在其中建立自己的用于发布和订阅的redis连接。当redis服务器运行时,当客户端连接到websocket服务器时,我可以看到正在建立的两个新连接,我也可以向客户端发布数据,但是当客户端断开与websocket服务器的连接时,我也想要断开与Redis的连接。我该怎么做?也许我做错了,但这是我的代码。#require'redis'require'em-websocket'require'em-hiredis'require'json'CLIENTS=Hash.newclassPubSubdefinitialize(client)@so

ruby - 如何在 websocket eventmachine 中断开 redis 客户端

我正在尝试构建一个websocket服务器,每个客户端在其中建立自己的用于发布和订阅的redis连接。当redis服务器运行时,当客户端连接到websocket服务器时,我可以看到正在建立的两个新连接,我也可以向客户端发布数据,但是当客户端断开与websocket服务器的连接时,我也想要断开与Redis的连接。我该怎么做?也许我做错了,但这是我的代码。#require'redis'require'em-websocket'require'em-hiredis'require'json'CLIENTS=Hash.newclassPubSubdefinitialize(client)@so

ruby - 简单使用 EM::Synchrony#sync 会导致 'root fiber' FiberError——我的错?

这个程序require'em-synchrony'##v1.0.0require'em-hiredis'##v0.1.0moduleEventMachinemoduleHiredisclassClientdefself.connect(host='localhost',port=6379)conn=new(host,port)EM::Synchrony.syncconn.connectconnendalias:old_method_missing:method_missingdefmethod_missing(sym,*args)EM::Synchrony.syncold_method

ruby - 简单使用 EM::Synchrony#sync 会导致 'root fiber' FiberError——我的错?

这个程序require'em-synchrony'##v1.0.0require'em-hiredis'##v0.1.0moduleEventMachinemoduleHiredisclassClientdefself.connect(host='localhost',port=6379)conn=new(host,port)EM::Synchrony.syncconn.connectconnendalias:old_method_missing:method_missingdefmethod_missing(sym,*args)EM::Synchrony.syncold_method

ruby - 建议在 Goliath 中使用的 Redis 驱动程序?

在EventMachine中建立Redis连接似乎有多种选择,我很难理解它们之间的核心区别。我的目标是在Goliath内实现Redis我现在建立连接的方式是通过em-synchrony:require'em-synchrony'require'em-synchrony/em-redis'config['redis']=EventMachine::Synchrony::ConnectionPool.new(:size=>20)doEventMachine::Protocols::Redis.connect(:host=>'localhost',:port=>6379)end上述方法与使用

ruby - 建议在 Goliath 中使用的 Redis 驱动程序?

在EventMachine中建立Redis连接似乎有多种选择,我很难理解它们之间的核心区别。我的目标是在Goliath内实现Redis我现在建立连接的方式是通过em-synchrony:require'em-synchrony'require'em-synchrony/em-redis'config['redis']=EventMachine::Synchrony::ConnectionPool.new(:size=>20)doEventMachine::Protocols::Redis.connect(:host=>'localhost',:port=>6379)end上述方法与使用

ruby - 我是否以正确的方式使用 eventmachine?

我正在使用ruby​​-smpp和redis来实现基于队列的后台工作程序来发送SMPP消息。而且我想知道我是否以正确的方式使用eventmachine。它有效,但感觉不对。#!/usr/bin/envruby#SampleSMSgatewaythatcanreceiveMOs(mobileoriginatedmessages)and#DRs(deliveryreports),andsendMTs(mobileterminatedmessages).#MTsare,inthenameofsimplicity,enteredonthecommandlineintheformat##MOsa

ruby - 我是否以正确的方式使用 eventmachine?

我正在使用ruby​​-smpp和redis来实现基于队列的后台工作程序来发送SMPP消息。而且我想知道我是否以正确的方式使用eventmachine。它有效,但感觉不对。#!/usr/bin/envruby#SampleSMSgatewaythatcanreceiveMOs(mobileoriginatedmessages)and#DRs(deliveryreports),andsendMTs(mobileterminatedmessages).#MTsare,inthenameofsimplicity,enteredonthecommandlineintheformat##MOsa

ruby - 使用 bundler 为不同平台加载不同版本的 gem

所以我正在为Windows和Linux开发一个Sinatra。问题是我使用的是Thin而不是Webrick,而eventmachineforwindows仅适用于预发布版本,而linux使用最新的稳定版。在gemfile中,您当然不能像这样包含具有不同版本的相同gem:gem"eventmachine","~>1.0.0.beta.4.1",:group=>:development_wingem"eventmachine",group=>:development_linuxgem"thin我想知道是否有解决此问题的方法,也许对Windows使用一个gemfile,对linux使用一个g