Home

Awesome

scalajs-gremlin-client

Legacy software - due to discontinued reactive-websocket and too big Monix breaking changes

Allows your browser applications to communicate with Gremlin Server via reactive-websocket thanks to Monix and uPickle.

Mainly it approaches :

Testing

This expects gremlin-sever be already running, please see sbt settings :

> js/fastOptStage::test

This starts gremlin-server before running a test suite if you have gremlinServerHome set up correctly :

> js/test

Usage

// requests are built using js.Dynamic literals 
lit(
  EvalOp,
  DefaultProc,
  Args(
    lit(
      GremlinArg("g.v(1)"),
      BatchSizeArg(20),
      LangArg("gremlin-groovy")
    )
  )
)

// import all types or just those that you'll need
 import com.pragmaxim.gremlin.client._

// connect to server
val client = GremlinClient(Url(WS, "localhost", 8182, Option.empty))

// sending a request requires specifying return type information to satisfy uPickle's Reader TypeClass. 
// You'll get strongly typed result in return...
val observable = client.send[Vector[Vertex]](query)

// do all kinds of Rx operations 
observable.map(...).filter(...).foreach(...) 

NOTE :