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

Expose interface for custom backends #8

Open
facekapow opened this issue May 1, 2016 · 0 comments
Open

Expose interface for custom backends #8

facekapow opened this issue May 1, 2016 · 0 comments

Comments

@facekapow
Copy link
Contributor

This is another runtime http related issue.

I think that there should be a way to add custom backends, because I had to access to many "private" properties while writing the http module for runtime. Maybe a class that provides default, overridable implementations of the methods? Something like:

const custom = new eshttp.HttpBackend({
  server: (serverInterface) => {
    return new SomeServer((socket) => {
      socket.on('data', (data) => serverInterface.ondata(data));
      socket.on('end', () => serverInterface.onend());
      socket.on('close', () => serverInterface.onclose());
      socket.on('error', (err) => serverInterface.onerror(err);
    });
  },
  client: (clientInterface) => {
    // ...
  }
});
custom.close = (socket) => socket.someOtherNameForClose();
// everything else is left as default

Anyway, it's just a proposal.

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

No branches or pull requests

1 participant