我正在尝试连接到应该在端口 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/