gremlin-javascript icon indicating copy to clipboard operation
gremlin-javascript copied to clipboard

Confirming this library runs in the browser ?

Open ordinaryorange opened this issue 7 years ago • 3 comments

I've tried to run the client in chrome to connect to Azure cosmos without luck. Upon inspection via fiddler, the connection does not seem to be promoting to a websocket. I see all tests are node and all examples I can find online are node based.

Is browser possible as per the opening remarks of readme ?

ordinaryorange avatar Feb 09 '18 03:02 ordinaryorange

I am very curious about this as well.

philosaur avatar Feb 13 '18 22:02 philosaur

Having a similar problem - had a look at the requests and got the following:

GET /gremlin HTTP/1.1
Host: localhost:8182
Connection: keep-alive
Pragma: no-cache
Cache-Control: no-cache
Origin: http://localhost:8080
User-Agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/64.0.3282.119 Safari/537.36
Accept: */*
Referer: http://localhost:8080/
Accept-Encoding: gzip, deflate, br
Accept-Language: en-US,en;q=0.9

This led to a response of 'not a WebSocket handshake request: missing upgrade'.

I tested another websocket connection, which made a successful connection to the same gremlin server, and the request looked like this:

GET /gremlin HTTP/1.1
Host: localhost:8182
Connection: Upgrade
Pragma: no-cache
Cache-Control: no-cache
Upgrade: websocket
Origin: file://
Sec-WebSocket-Version: 13
User-Agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/64.0.3282.119 Safari/537.36
Accept-Encoding: gzip, deflate, br
Accept-Language: en-US,en;q=0.9
Sec-WebSocket-Key: lEslnVBk32uXrH45/G8rSA==
Sec-WebSocket-Extensions: permessage-deflate; client_max_window_bits

It looks like this is the same problem - I have been unable to get this library to send a ws connection over the browser.

dbugsy avatar Feb 15 '18 17:02 dbugsy

It used to work in the browser in earlier version, about 3 years ago, but I couldn't confirm today (the README is misleading, I confess). I think it shouldn't be too hard to tweak the code to make it work in browsers. The size of the bundle could be an issue though since I never really tried to do optimization there. Any of you willing to have a look?

jbmusso avatar Apr 05 '18 21:04 jbmusso