LinkedDataFragments / Client.js

[DEPRECATED] A JavaScript client for Triple Pattern Fragments interfaces.

Home Page:http://linkeddatafragments.org/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

How to close?

jacoscaz opened this issue · comments

Possibly related to #38.

I have a Mocha suite in which I'm trying to tear down and re-create a ldf-client (and a ldf-server) using beforeEach() / afterEach(). However, I can't seem to find a way to force the client to close its connections. .abortAll() does not seem to work. The moment the ldf-server destroys the connection, ECONNREFUSED comes up. Any tips?

EDIT: branch is feature-qpf-latest

For now the abortAll function has been updated to make sure it will always stop all connections (in the develop branch, so will have to be added to the other branches too). This is still not a completely clean solution as abortAll was intended as a hackish way to quickly disable the system (for the browser client).

So the safest solution would probably be to catch the errors when closing in the afterEach and creating a new client in the beforeEach.

For anyone interested, the stoppable module (https://github.com/hunterloftis/stoppable) tracks the state of http connections and allows to shut down a server as soon as possible - keep-alive connections included - while still allowing in-flight requests to go through. Nifty module!

This project has now been deprecated in favor of Comunica, where this should not be a problem anymore. If it is, feel free to open a new issue there.