go - 如何连接到 Go 中的 Gremlin Websocket?

标签 go websocket gremlin gremlin-server

我正在尝试连接到应该在端口 8182 上运行的 Gremlin([INFO] GremlinServer$1 - Channel started at port 8182)

当我连接到:ws://127.0.0.1:8182 我得到响应:

2017/11/03 17:20:04 ERROR: database with the name 'gremlin' gave an error when connecting: websocket: bad handshake.

Gremlin 服务器响应:

[WARN] HttpGremlinEndpointHandler - Invalid request - responding with 400 Bad Request and no gremlin script supplied

我正在使用 Gorilla Websocket在去连接:

gremlinGrpcAddress := fmt.Sprintf("ws://%s:%d/", f.config.Host, f.config.Port)

var dialer *websocket.Dialer

clientConn, _, err := dialer.Dial(gremlinGrpcAddress, nil)
if err != nil {
    return err
}

f.client = clientConn

更新:
连接到 echo.websocket.org 可以正常工作,所以不知何故它在 Gremlin 服务器中。

最佳答案

答案就在配置 YAML 文件中。

需要的是正确的 channel 化器。

好:

channelizer: org.apache.tinkerpop.gremlin.server.channel.WebSocketChannelizer

关于go - 如何连接到 Go 中的 Gremlin Websocket?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47100341/

相关文章:

http - 将 WebSocket 升级到 TLS

azure - Cosmos db graph 与 Azure Sql Server - 性能和成本

python - 在 IPython Notebook 中检索或存储 AWS Neptune ML 中的 Gremlin 查询结果

go - 获取 go package gin 时无法识别的导入路径

templates - 告诉 Golang 先执行哪个模板

pointers - 如何将不同的错误接口(interface)实现存储在一起,然后在 Go 中使用它们进行类型比较?

ruby-on-rails - Ruby - 向 Websocket 发送消息

python - 为什么我的程序退出而不是永远运行

python-3.x - 使用 aiogremlin 连接到 Neptune

go - 计算预定义数字类型之外的大数