Comments (5)
Thanks - I just pushed a commit. I take a lot of inspiration from node_redis so I named the event error
(see https://github.com/NodeRedis/node_redis#connection-events).
I also need to add a way to automatically reconnect. Using https://www.npmjs.com/package/retry could help, but I need to give it more thought.
from gremlin-javascript.
Thank you for the swift fix. However, the 'error'
event is already used for query errors, so any use-case that I can think of would need an if
inside the event handler to differentiate connection errors from query errors.
Example:
function connectClient = function(host, port, done) {
var client = gremlin.createClient(host, port);
client.on('connect', function() {
done(null, client);
}).on('error', function(err) {
// could be a query error after connection has already succeeded
if (!client.connected) {
done(err);
}
});
I believe it would be much simpler to have different event names for connection errors and query errors.
from gremlin-javascript.
Ah, I see what you mean. Let me think that through, there might indeed be a better way to name that event or to distinguish between client events and query (= ReadableStream
) events.
from gremlin-javascript.
I'm thinking about adding a disconnect
event at the client level (= Websocket disconnection errors) in order to distinguish from the current error
event which can be emitted by result steams when using the .stream()
API. Unless I'm mistaken, the client instance doesn't emit an error
event should a stream error actually occur, though I might be wrong on that one - I'll have to check/test that.
Feel free to provide feedback!
from gremlin-javascript.
I'm no t sure about the disconnect
semantics as this can happen if connection never took place (e.g.: tried to connect but failed because the provided port was wrong).
from gremlin-javascript.
Related Issues (20)
- Is it supports the GraphSONMessageSerializerV3d0? HOT 1
- Publish latest version of Gremlin client HOT 1
- Confirming this library runs in the browser ? HOT 3
- Is direct graph management possible? HOT 1
- Multiple properties on a vertex is not supported HOT 2
- Gremlin Client NPM Version Clarification HOT 2
- Working example? HOT 2
- Unable to send a new query over wss before the last one is returned HOT 4
- Working GraphSON read/write example?
- CosmosDB x-ms-retry-after-ms header access HOT 2
- Gremlin.createClient is not a function HOT 2
- How to use functions like "within"
- buildChallengeResponse: SASL parameter is incorrectly set for Tinkerpop HOT 4
- Can't connect to JanusGraph on Compose HOT 2
- Error: Expected Stream, got object HOT 13
- Support for connecting to a graph cluster with multiple gremlin-servers HOT 1
- Silently throws away data from the response if it contains UTF-8 characters HOT 2
- Janusgraph Server connection intermittently throws error: not opened at WebSocket.send HOT 1
- TypeScript Definition Files HOT 2
- Error: this.connection.close is not a function
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from gremlin-javascript.