Skip to content

feat(node): Add a dirty version of transports#1316

Merged
jan-auer merged 1 commit into
nextfrom
feat/next-node-transports
May 2, 2018
Merged

feat(node): Add a dirty version of transports#1316
jan-auer merged 1 commit into
nextfrom
feat/next-node-transports

Conversation

@jan-auer
Copy link
Copy Markdown
Member

@jan-auer jan-auer commented Apr 30, 2018

This adds an internal method NodeBackend.setTransport that can take any module or object that looks like the http object. This is actually required by getsentry/sentry-electron#73 to use the electron.net module instead of node's own http implementation.

Since we do not have a clear design specification for transports yet, this API should be considered internal for now.

Details

Usually, we would add a transport option to the SDKs, just like raven-node and raven-js already have it. However, this approach would have two significant drawbacks:

  1. There is no way we can set an option in the Electron frontend which will only be used by the Node backend and not by the Browser backend (actually, there is one, but it is super dirty).
  2. I do not want to export Raven's transport interface to the "user" just now. The interface seems like the wrong layer of abstraction.

Instead, we can now manually set a transport to the backend instance directly using the setTransport setter. It needs to implement the exact signature of http.request.

For an example, have a look at ElectronBackend.

@jan-auer jan-auer merged commit dcc427a into next May 2, 2018
@jan-auer jan-auer deleted the feat/next-node-transports branch May 2, 2018 10:05
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