Connecting to local gremlin server with websocket address

Hello everyone. I'm looking for help with a client app written in Java that uses Tinkerpop Gremlin to interact with a Janusgraph instance. When developing new features, I run a local Janusgraph with a Gremlin server at localhost. I'm trying demonstrate that I can take a websocket url and establish a connection using that URL. I believe that the default websocket address for a local Gremlin server is ws://127.0.0.1:8182/gremlin. I'm trying to use a Cluster to create the connection and obtain a GraphTraversalSource. Here's what I'm trying. Cluster cluster = Cluster.build("ws://127.0.0.1:8182/gremlin").create(); GraphTraversalSource g = AnonymousTraversalSource.traversal().withRemote(DriverRemoteConnection.using(cluster)); This is throwing -- IllegalArgumentException: No such host is known (ws://127.0.0.1:8182/gremlin). Am I doing something wrong? Any help apprecitated!
Solution:
By default it will connect via websocket so you can try ``` Cluster cluster = Cluster.build("localhost"). path("/gremlin"). create();...
Jump to solution
3 Replies
Solution
ryn
ryn15mo ago
By default it will connect via websocket so you can try
Cluster cluster = Cluster.build("localhost").
path("/gremlin").
create();
Cluster cluster = Cluster.build("localhost").
path("/gremlin").
create();
dee2xu
dee2xuOP15mo ago
Thanks, Ryan. Just to check my understanding here -- if i have an 'aliased' websocket URL, something like ws://mydomainname.com, then I would do Cluster cluster = Cluster.build("mydomainname.com"). path("/gremlin"). create(); correct?
ryn
ryn15mo ago
Yes I believe that's correct
Want results from more Discord servers?
Add your server