Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Keep-alive (reuse) connections running in NodeJS environment to reduce the number of new connections #83

Merged
merged 1 commit into from
Oct 8, 2019

Conversation

frol
Copy link
Collaborator

@frol frol commented Oct 4, 2019

@@ -11,7 +11,29 @@ export interface ConnectionInfo {
headers?: { [key: string]: string | number };
}

const fetch = (typeof window === 'undefined' || window.name === 'nodejs') ? require('node-fetch') : window.fetch;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Feel like makes sense to extract into separate package. Like e.g. in wallet I use this package:
https://github.com/nearprotocol/send-json/blob/master/index.js

We should just extend it with other goodies.

Copy link
Contributor

@vgrichina vgrichina left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, but I think we should also extract this into common module, as going to be useful for more than just nearlib.

@frol
Copy link
Collaborator Author

frol commented Oct 5, 2019

@vgrichina Could you do that? (It will require releases on npmjs, anyway.)

@vgrichina
Copy link
Contributor

ok

@vgrichina vgrichina merged commit 94f1a39 into master Oct 8, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants