Skip to content

Expose interface for custom backends #8

Description

@facekapow

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.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions