Websocket: provide API to collect streamed messages automatically
- Dominant language
- Scala
- Stars
- 1.4k
- Forks
- 584
- Avg merge
- 14h 33m
- Merged PRs (30d)
- 24
Description
**Issue by [jrudolph](https://github.com/jrudolph)**
_Friday Dec 04, 2015 at 13:07 GMT_
_Originally opened as https://github.com/akka/akka/issues/19089_
---
Most applications deal only with small Websocket messages in which case it is feasible to aggregate all frames of a message and only dispatch Strict messages.
E.g. see this thread: https://groups.google.com/d/msg/akka-user/LtxcEZtUhdI/hAY7F4LLAwAJ
It is currently quite hard to achieve this manually and a solution on top of the current implementation is inefficient because first a streamed message is created containing a substream that needs to be aggregated afterwards which (at least right now) introduces considerable overhead.
A solution would be to introduce an alternative entrypoint in `UpgradeToWebsocket` where the user can directly supply a `Flow[Message.Strict, Message, Any]` and thus only has to handle strict messages. This could be implemented efficiently by never even trying to create streamed messages and so get rid of `headAndTail` etc.
Contributor guide
Research direction
Start by reading the UpgradeToWebsocket entrypoint and the current handling around headAndTail. Trace how streamed websocket messages are created and aggregated, then evaluate the proposed Flow[Message.Strict, Message, Any] entrypoint. Done means applications can receive automatically collected strict messages without creating streamed messages first.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- scala
- Domain
- api, backend
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100