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

Publisher和Subscriber #6

Open
LeeSen11 opened this issue Nov 25, 2020 · 0 comments
Open

Publisher和Subscriber #6

LeeSen11 opened this issue Nov 25, 2020 · 0 comments

Comments

@LeeSen11
Copy link
Owner

  • Publisher将一段时间内的一系列值以同步或异步的方式传递给一个或多个订阅者
  • subscriber可以通过对publisher进行订阅来接收数据,但是subscriber的输入类型和错误类型必须要和publisher的输出类型和错误类型一致
  • Publisher内置了两个操作符用于对publisher对象进行订阅,sink(::)和assign(to:on:)
  • subscriber在每次接收到数据的时候可以增加接收数据的数量,但是只能增加,不能减少
  • 当不需要监听之后,需要取消subscription来清理资源及避免其他问题出现
  • Future对象可以在某个时间点异步的接收单个数据
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

No branches or pull requests

1 participant