JavaScript connection timeout OrientDB with Javascript API orientdb connection timeout

In my webapp client side script I'm using the OrientDB Javascript API (orientdb-api.js). When the script initializes I run this code:

var orientdb = new ODatabase("http://localhost:2480/testapp");
var orientdbinfo = orientdb.open('root', 'admin');

This works fine and I can do all the various queries etc, as long as I don't wait more than 15 seconds between them. If I do, I get "error 401 (Unauthorised)" returned.

I know for a fact that this is the socket connection timing out. The timeframe matches the 15000ms timeout setting in the config. Also, as a test I've built a little button that calls the orientdb.open method above and reopens the connection. After I hit that button I can access the DB again.

Currently the queries and commands are being called directly in my script as I trigger actions from my web UI. Am I just being lazy and am I actually supposed to wrap every query in a function that tests the connection first and re-initializes if it is closed, or is there something I'm missing? If the former, what is an elegant way of coding that? If the latter, what am I missing?

To get around this I'm running a setInterval function that opens a new socket every 14 seconds. That will get me through my testing for sure, but I realise it's a hack.

Answer:1

I have created custom angular directive. For an example: Custom directive: var app=angular.module('app',[]); app.directive('customDirective',function(){ return{ restrict:A, controller:...

I have created custom angular directive. For an example: Custom directive: var app=angular.module('app',[]); app.directive('customDirective',function(){ return{ restrict:A, controller:...

  1. passing data from child to parent react
  2. passing data from one component to another
  3. passing data from child to parent angular
  4. passing data from parent to child
  5. passing data from controller to view
  6. passing data from php to javascript
  7. passing data from child to parent vue
  8. passing data from activity to fragment
  9. passing data from view to controller in mvc
  10. passing data from laravel to vue
  11. passing data from child to parent react hooks
  12. passing data from flask to javascript
  13. passing data from html to javascript
  14. passing data from rails to react
  15. passing data from child to child react
  16. passing data from one fragment to another
  17. passing data from controller to view laravel
  18. passing data from one lambda to another
  19. passing data from jsp to servlet
  20. passing data from iframe to parent

So I have something like this.editElement = $("<a href='#'>Edit</a>").click(function() { this.startEdit(); }); This however takes "this" to be the editElement itself, rather than the ...

So I have something like this.editElement = $("<a href='#'>Edit</a>").click(function() { this.startEdit(); }); This however takes "this" to be the editElement itself, rather than the ...

  1. jquery this inside function
  2. jquery this inside this
  3. jquery this inside each
  4. jquery this inside click function
  5. jquery this inside class
  6. jquery this inside if
  7. jquery this inside ajax success
  8. jquery this inside event handler
  9. jquery this inside element
  10. jquery this inside each loop
  11. jquery this inside ajax
  12. jquery this inside click
  13. jquery this inside event
  14. jquery this inside onclick
  15. jquery this inside class selector
  16. jquery access this inside function
  17. jquery inside html
  18. jquery inside php
  19. jquery inside iframe
  20. jquery inside javascript

I have a function: var foo = function() { document.write( bar() ); }; My Jasmine test is: describe('has a method, foo, that', function() { it('calls bar', function() { spyOn(window, ...

I have a function: var foo = function() { document.write( bar() ); }; My Jasmine test is: describe('has a method, foo, that', function() { it('calls bar', function() { spyOn(window, ...

I m trying to add page number in footer this is my code var pdfInfo = {}; var x = document.location.search.substring(1).split('&'); for (var i in x) { var z = x[i].split('=',2); pdfInfo[z[...

I m trying to add page number in footer this is my code var pdfInfo = {}; var x = document.location.search.substring(1).split('&'); for (var i in x) { var z = x[i].split('=',2); pdfInfo[z[...