问题标签 [goliath]

For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.

0 投票
1 回答
660 浏览

ruby - Multiple subscribers with EM-WebSocket or Goliath

So I'm attempting to setup em-websocket (or potentially Goliath), so that users can come to a different route and thusly be subscribed to only that channel, so for example:

Browsers open there will only receive messages published to channel_1, actually to that point it doesn't have to be a route like this I'd settle for using params. So I'm using AMQP and it has the notion of a direct exchange, and routing keys. Is there something analogous to that with websockets?

I've got a Goliath server working but the issue is, that because it uses shared endpoints, I think that all the browsers open with a websocket connection are getting the same messages, here's what I'm doing:

So this example uses AMQP, which I'd still like to use, but the issue I think lies in that each client is reinstantiating EM::Channel.new, and then the messages are pushed to that channel, I just don't understand how I would have multiple clients subscribed to different channels.

Any help understanding this or guiding me to a more appropriate design pattern.

0 投票
1 回答
424 浏览

ruby - 如何使用 Goliath/Heroku 进行 HTTP 身份验证?

我正在使用 Goliath 作为我的应用程序服务器,并且我正在尝试转换“ Ruby – 来自用户和机器人的公共应用程序的安全登台环境”,因此它适用于我的 Goliath 应用程序。

我正在尝试使用Rack::Static,但我不确定如何编写代码。我正在尝试类似的东西:

但我不太确定如何翻译我发布的链接。

我对其他选择持开放态度,我只需要保护我的整个站点密码。

0 投票
1 回答
595 浏览

goliath - 如何使用 goliath 和葡萄发送数据或附件?

不知道这是如何完成的,但是按照它在 Sinatra 中的完成方式不会在 Goliath 上削减它 -如何从 Sinatra 发送二进制数据?

0 投票
1 回答
496 浏览

asynchronous - Goliath 或 EventMachine 如何切换上下文?

假设我有一个 I/O 受限的操作。我确实有回调(或 em 同步)

  1. EM 如何切换到处理下一个请求保持前一个等待回调?
  2. 它如何使 Thread.current 变量保持隔离?
  3. 如何模拟长时间运行的作业?
0 投票
1 回答
495 浏览

ruby - 我应该将 EM::Synchrony::Multi 或 EM::Synchrony::FiberIterator 与 Goliath 一起使用吗?

也许这是错误的方法,但我正在尝试将 Goliath 中的 em-hiredis放置和查找与EM::Synchrony::Multior并行化EM::Synchrony::FiberIterator。但是,我似乎无法访问在 config 中初始化的基本值。我不断收到method_missing错误。

这是我正在尝试做的基本淡化版本:

这是基本的歌利亚设置

但是,我不断收到错误,因为 Goliath 不知道在配置中初始化了什么user_agentredis_db哪些被初始化。

理想情况下,我可以开始FiberIterator工作,因为我还有其他条件要检查:

0 投票
1 回答
122 浏览

ruby - 需要后的Ruby默认类操作

我记得这个问题以前出现过,但我找不到答案。

我需要这样的文件:

而且,在没有显式调用 Listen 类的情况下,它initialize会被执行:

如何避免在 require 上初始化类?

0 投票
1 回答
849 浏览

ruby - CORS SSE - 未捕获的错误:SECURITY_ERR:DOM 异常 18

我正在开发一个流媒体服务器,它使用Goliath和 SSE 实时发送最新推文、新闻 ets 等更新。该服务器将映射到不同的域。

索引.html

歌利亚组件

Goliath 流媒体服务器在本地机器的 9000 端口上运行。当我尝试通过http://localhost/index.html它访问页面时,即使它发送 CORS 'Access-Control-Allow-Origin' 标头作为响应,也会给出 Chrome 中提到的错误。请不要在这里它在FF上工作正常。

知道如何解决这个问题吗?

0 投票
2 回答
800 浏览

ruby - Ruby goliath 非阻塞服务器映射

我正在尝试 goliath 非阻塞红宝石服务器。

对于我的应用程序,我需要创建至少 2 条已定义的路线,比如说“/call_one”和“/call_two”,每个地图应该以不同的方式响应。

Goliath 文档提到了地图功能,这正是我所需要的。但它不再存在于source中。

0 投票
1 回答
502 浏览

ruby - 新遗物与歌利亚的整合

我已经用 goliath 配置了 New Relic,如此处所述

我正在使用gem 'newrelic_rpm',但没有获得 newrelic 服务的统计信息。

0 投票
3 回答
2734 浏览

ruby - 使用 Rspec 测试 Goliath + Grape

我正在尝试测试 Goliath + Grape 应用程序,如下所示:

这两个类位于一个名为 app.rb 的文件中。运行ruby ./app.rb -sv启动一个http://0.0.0.0:9000/v1/categories/可以完美运行的 goliath 应用程序,但在制作更复杂的端点之前需要 rspec。无论如何运行我得到的规范

未定义的局部变量或方法“app”

我无法摆脱:

api_spec 如下所示:

更新 :

将 app 方法添加到 spec/api_spec.rb :

引发另一种错误:

更新

在 spec/api_spec.rb 中添加从 app 方法调用的 API 类:

得到undefined methodmongo'`:

coll = env.mongo.collection('categories')内部 API 类