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

feat(core, websockets): Effects output stream #96

merged 1 commit into from Jan 26, 2019


2 participants
Copy link

commented Jan 25, 2019

PR Type

What kind of change does this PR introduce?

[ ] Bugfix
[x] Feature
[ ] Code style update (formatting, local variables)
[ ] Refactoring (no functional changes, no api changes)
[ ] Build related changes
[ ] CI related changes
[ ] Documentation content changes
[ ] Other... Please describe:

What is the current behavior?

[...] response interceptor to modify certain type of responses for various reasons. Such as when Accept header is application/vnd.api+json, so maybe there is a stream of outgoing message which can be use to adjust the response accordingly. The API endpoint should worry only about resource being worked on. The exact data sent over wire or its representation is orthogonal to the API endpoint. Or in other case, when RouteEffect sends 404 as a status code. It will be intercepted by common code that will send appropriate message depending upon the Accept header.
@mistyharsh <<

Issue Number: #83

What is the new behavior?

The API design shouldn't define any sort of additional post-Effect middlwares. In order to have a consistent API and preserve stream-like nature of the framework, each listener (HTTP, WebSockets) should expose an additional output stream where the developer can adjust the outputted EffectResponse accordingly to the needs.


const httpServer = httpListener({
  middlewares: [ ... ],
  effects: [ ... ],
  output$: out$ => out$.pipe(
    // intercept Effect response and adjust it to your needs accordingly ☺️


const webSocketServer = webSocketListener({
  middlewares: [ ... ],
  effects: [ ... ],
  output$: out$ => out$.pipe(
    // intercept Effect response and adjust it to your needs accordingly ☺️

Does this PR introduce a breaking change?

[ ] Yes
[x] No

@JozefFlakus JozefFlakus added this to the 2.0.0 milestone Jan 25, 2019

@JozefFlakus JozefFlakus self-assigned this Jan 25, 2019

@JozefFlakus JozefFlakus added this to In progress in @marblejs/next via automation Jan 25, 2019


This comment has been minimized.

Copy link

commented Jan 25, 2019

Codecov Report

Merging #96 into next will not change coverage.
The diff coverage is 100%.

Impacted file tree graph

@@         Coverage Diff         @@
##           next    #96   +/-   ##
  Coverage   100%   100%           
  Files        76     76           
  Lines       957    961    +4     
  Branches     85     85           
+ Hits        957    961    +4
Impacted Files Coverage Δ
packages/core/src/http.interface.ts 100% <ø> (ø) ⬆️
...s/core/src/response/responseContentType.factory.ts 100% <100%> (ø) ⬆️
packages/core/src/listener/http.listener.ts 100% <100%> (ø) ⬆️
...ages/websockets/src/listener/websocket.listener.ts 100% <100%> (ø) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update a5f5a40...d48ad86. Read the comment docs.

@marblejs/next automation moved this from In progress to Reviewer approved Jan 25, 2019

@JozefFlakus JozefFlakus merged commit 5cdcedf into next Jan 26, 2019

2 checks passed

Travis CI - Pull Request Build Passed
codecov/patch 100% of diff hit (target 100%)

@marblejs/next automation moved this from Reviewer approved to Done Jan 26, 2019

@JozefFlakus JozefFlakus deleted the feat/next/output-stream branch Jan 26, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.