Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reading the Emacs-Gremlin communication #1

Open
JeffreyBenjaminBrown opened this issue Apr 23, 2017 · 1 comment
Open

Reading the Emacs-Gremlin communication #1

JeffreyBenjaminBrown opened this issue Apr 23, 2017 · 1 comment

Comments

@JeffreyBenjaminBrown
Copy link
Member

I can listen to their communication by issuing a command like this:

jeff@jbb-thinkpad:~/smsn+/smsn$ sudo tcpdump -s 0 -A -v -i docker0 port 8182
tcpdump: listening on docker0, link-type EN10MB (Ethernet), capture size 262144 bytes

That's almost what Josh suggested, except on his Mac the interface is lo0 rather than docker0.

From the note with id 23J3krPbTqWF8t2r (in data-public), with the view height at 1 and the minimum shareability at private, if I press "f" to reload the forward-view, tcpdump rewards me with the following transcript:

14:39:02.398875 IP (tos 0x0, ttl 64, id 1249, offset 0, flags [DF], proto TCP (6), length 383)
    172.17.0.1.39706 > 172.17.0.2.8182: Flags [P.], cksum 0x5997 (incorrect -> 0xded4), seq 1389924258:1389924589, ack 2017200932, win 1444, options [nop,nop,TS val 20651566 ecr 20552974], length 331
E.....@.@..r............R...x<.$....Y......
.;...9.....C...Au..1,.2$x.|c".`3a.u2}.bc4.c$}.y.`.<co.w2,.kcb.~&{.w$,.22c.~c".c$}.y.`.*c{.t$h.~$j.<ci.u,b.~c4.k.,.s5g.~.,.Lc`.doh.b5w.g. .}2`.c$|.u3 .s5g.~2 .u5X.u6R.<.,.y-z.b.,.k.,.y/].q3o.y-g.i.,. o>.Lcj.v {.d.f.b l.|(z.Lc4.>v;.Lcc.~.k.w)z.2{>. mR.t$h.e-z.u(i.d.,. o;.<.,...z.2{R."rD.{3^.D0Y.(5<.Lc".2)k.w)z.2{?.Lc}.i-k.2{R.v.|.q3j.2<,.m
14:39:02.407819 IP (tos 0x0, ttl 64, id 33023, offset 0, flags [DF], proto TCP (6), length 649)
    172.17.0.2.8182 > 172.17.0.1.39706: Flags [P.], cksum 0x5aa1 (incorrect -> 0xede6), seq 1:598, ack 331, win 493, options [nop,nop,TS val 20651568 ecr 20651566], length 597
E.....@.@._J............x<.$R.......Z......
.;.0.;...~.Q{"requestId":null,"status":{"message":"","code":200,"attributes":{}},"result":{"data":["{\"view\":{\"numberOfChildren\":1,\"children\":[{\"numberOfChildren\":1,\"created\":1343776406383,\"weight\":0.5,\"numberOfParents\":2,\"id\":\"8RX6n6dPIRYTZA7K\",\"sharability\":0.75,\"title\":\"brain plasticity ^ neocortical areas are fairly interchangeable\"}],\"created\":1486193684087,\"weight\":0.5,\"numberOfParents\":1,\"id\":\"23J3krPbTqWF8t2r\",\"sharability\":0.75,\"title\":\"e.g. in this note you wrote\"},\"root\":\"23J3krPbTqWF8t2r\",\"title\":\"e.g. in this note you wrote\"}"],"meta":{}}}
14:39:02.407847 IP (tos 0x0, ttl 64, id 1250, offset 0, flags [DF], proto TCP (6), length 52)
    172.17.0.1.39706 > 172.17.0.2.8182: Flags [.], cksum 0x584c (incorrect -> 0xb591), ack 598, win 1444, options [nop,nop,TS val 20651568 ecr 20651568], length 0
E..4..@.@...............R...x<.y....XL.....
.;.0.;.0

My guess is that 172.17.0.1.39706 is Emacs, 172.17.0.2.8182 is Gremlin, and the exchange went like this:

  Emacs: Can I have some data?
  Gremlin: Here you go.
  Emacs: Got it.

If that's what happened, I can parse some of what Gremlin said, and none of what Emacs said. Are those two languages documented somewhere? And what is the meaning of the first line of output, before the three messages?

@joshsh
Copy link
Member

joshsh commented Apr 24, 2017

That is exactly the exchange between Emacs and Gremlin Server for a read (although the "got it" happens lower in the stack than the preceding lines). A write looks something like:

Emacs: Here is some new data.
Gremlin: Thanks! Here is what the graph looks like now.
Emacs: Got it.

To get at the content of the messages (in both directions), you will need to use a WebSocket-specific tool. It seems there are Chrome plugins which help with WebSocket inspection.

I generally set debug points in IDEA and run Gremlin Server in debug mode if I need low-level access to messages.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants