LinkedDataFragments / Client.js

[DEPRECATED] A JavaScript client for Triple Pattern Fragments interfaces.
http://linkeddatafragments.org/
Other
92 stars 35 forks source link

How to close? #39

Closed jacoscaz closed 4 years ago

jacoscaz commented 7 years ago

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

joachimvh commented 7 years ago

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.

jacoscaz commented 7 years ago

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!

rubensworks commented 4 years ago

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.