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

Duplicate streams to "shouldShare" channels #14

Open
coord-e opened this issue Dec 26, 2020 · 1 comment
Open

Duplicate streams to "shouldShare" channels #14

coord-e opened this issue Dec 26, 2020 · 1 comment
Assignees
Labels
enhancement New feature or request
Milestone

Comments

@coord-e
Copy link
Owner

coord-e commented Dec 26, 2020

You can't have more than two connections to the "shouldShare" channel.

https://github.com/syuilo/misskey/blob/572e475b394aab0fd752783da8648b4f096653fd/src/server/api/stream/index.ts#L220-L222

Quoting the current behavior from the documentation:

Note that currently it is not possible to have multiple connections to the main stream from the same client. If you try to do so, the Future returned by this method will not complete.

This is an inconvenient and confusing behavior for a library. It is expected that the implementation will make the connection the first time and reuse it for the second and subsequent connections.

Unresolved questions

  • Where to implement:
    • misskey-websocket: Almost looks good, but feel like the obligation (to duplicate the connection) is misplaced
    • misskey-util: We may need to stop using the extension trait, which is undesirable
@coord-e coord-e added the enhancement New feature or request label Dec 26, 2020
@coord-e
Copy link
Owner Author

coord-e commented Dec 31, 2020

After much consideration, I take an approach that follows FusedIterator on std. The current (and future) StreamingClient has no guarantee on its behavior with multiple attempt to connect to channels; it is just required to send the request and wait for the connection to be established. So, rather than having stronger requirement on StreamingClient, I implement a new trait (named like SharedConnectionStreamingClient) in misskey-util that require implementers to reuse the connection, thus the multiple attempt of connection on "shouldShare" channels must work properly on it. An additional method (named like share_channels) can be implemented on StreamingClientExt to obtain SharedConnectionStreamingClient from StreamingClient (like fuse method on IteratorExt).

@coord-e coord-e added this to the 0.3.0 milestone Jan 2, 2021
@coord-e coord-e self-assigned this Jan 17, 2021
@coord-e coord-e modified the milestones: 0.3.0, 0.4.0 May 16, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant