{"id":371443,"date":"2024-05-21T04:49:00","date_gmt":"2024-05-21T04:49:00","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=371443"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=371443","title":{"rendered":"<span>\u0417\u0430\u0447\u0435\u043c \u0432 \u043c\u043e\u0431\u0438\u043b\u044c\u043d\u043e\u0439 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c Flow, \u0435\u0441\u043b\u0438 \u0435\u0441\u0442\u044c \u043c\u043e\u0449\u043d\u044b\u0439 ChannelFlow?<\/span>"},"content":{"rendered":"<div><!--[--><!--]--><\/div>\n<div id=\"post-content-body\">\n<div>\n<div class=\"article-formatted-body article-formatted-body article-formatted-body_version-1\">\n<div xmlns=\"http:\/\/www.w3.org\/1999\/xhtml\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/webt\/jf\/a_\/nc\/jfa_ncv1oww95d2fkuaaxb0yjhs.png\" data-src=\"https:\/\/habrastorage.org\/webt\/jf\/a_\/nc\/jfa_ncv1oww95d2fkuaaxb0yjhs.png\"\/><\/p>\n<p>  \u042f \u0437\u043d\u0430\u044e, \u0447\u0442\u043e \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u0435\u0442 \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u043e \u0441\u0442\u0430\u0442\u0435\u0439 \u043e <code>flow<\/code> \u0438 <code>channelFlow<\/code>, \u0432 \u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u0447\u0430\u0441\u0442\u043e \u043f\u043e\u0434\u0447\u0451\u0440\u043a\u0438\u0432\u0430\u0435\u0442\u0441\u044f, \u0447\u0442\u043e <code>channelFlow<\/code> \u043f\u043e \u0441\u0443\u0442\u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442 <code>Channel<\/code>. \u041d\u043e \u0447\u0442\u043e \u044d\u0442\u043e \u043d\u0430 \u0441\u0430\u043c\u043e\u043c \u0434\u0435\u043b\u0435 \u0437\u043d\u0430\u0447\u0438\u0442 \u0434\u043b\u044f \u043c\u043e\u0431\u0438\u043b\u044c\u043d\u044b\u0445 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u043e\u0432? \u041a\u043e\u0433\u0434\u0430 \u044d\u0442\u043e \u0440\u0430\u0437\u043b\u0438\u0447\u0438\u0435 \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u0438\u043c\u0435\u0435\u0442 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435? \u041c\u043e\u0436\u043d\u043e \u043b\u0438 \u0434\u043e\u0431\u0438\u0442\u044c\u0441\u044f \u0442\u0430\u043a\u043e\u0433\u043e \u0436\u0435 \u043f\u043e\u0432\u0435\u0434\u0435\u043d\u0438\u044f \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e <code>flow<\/code> \u0431\u0435\u0437 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f <code>Channel<\/code>, \u0438 \u043a\u0430\u043a\u0438\u0435 \u0443\u043d\u0438\u043a\u0430\u043b\u044c\u043d\u044b\u0435 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u0438 \u043f\u0440\u0435\u0434\u043b\u0430\u0433\u0430\u0435\u0442 <code>ChannelFlow<\/code>, \u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u043d\u0435\u043b\u044c\u0437\u044f \u0434\u043e\u0441\u0442\u0438\u0447\u044c \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u043e\u0431\u044b\u0447\u043d\u043e\u0433\u043e <code>Flow<\/code>?<\/p>\n<p>  \u041a\u043b\u044e\u0447 \u043a \u044d\u0442\u043e\u043c\u0443 \u0432\u043e\u043f\u0440\u043e\u0441\u0443 \u043b\u0435\u0436\u0438\u0442 \u0432 \u043f\u043e\u043d\u0438\u043c\u0430\u043d\u0438\u0438 \u043e\u0441\u043d\u043e\u0432\u043d\u043e\u0439 \u043a\u043e\u043d\u0446\u0435\u043f\u0446\u0438\u0438 <code>Channel<\/code>. \u041a\u043e\u043d\u0446\u0435\u043f\u0442\u0443\u0430\u043b\u044c\u043d\u043e <code>Channel<\/code> \u0438 <code>Flow<\/code> \u0441\u043b\u0443\u0436\u0430\u0442 \u0440\u0430\u0437\u043d\u044b\u043c \u0446\u0435\u043b\u044f\u043c. \u041a\u0430\u043d\u0430\u043b\u044b (Channels) \u043e\u0431\u043b\u0435\u0433\u0447\u0430\u044e\u0442 \u0432\u0437\u0430\u0438\u043c\u043e\u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0435 \u043c\u0435\u0436\u0434\u0443 \u043a\u043e\u0440\u0443\u0442\u0438\u043d\u0430\u043c\u0438, \u0432 \u0442\u043e \u0432\u0440\u0435\u043c\u044f \u043a\u0430\u043a \u043f\u043e\u0442\u043e\u043a\u0438 (Flows) \u0431\u043e\u043b\u044c\u0448\u0435 \u043d\u0430\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u044b \u043d\u0430 \u044d\u0444\u0444\u0435\u043a\u0442\u0438\u0432\u043d\u043e\u0435 \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0441\u0442\u0432\u043e \u0438 \u0440\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u0435 \u0434\u0430\u043d\u043d\u044b\u0445.<\/p>\n<p>  <code>ChannelFlow<\/code> \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442 <code>Channel<\/code> \u0434\u043b\u044f \u0441\u0432\u043e\u0438\u0445 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0439, \u0447\u0442\u043e \u0434\u0435\u043b\u0430\u0435\u0442 \u0435\u0433\u043e \u043c\u043e\u0449\u043d\u044b\u043c \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442\u043e\u043c \u0432 \u0441\u0446\u0435\u043d\u0430\u0440\u0438\u044f\u0445, \u0432\u043a\u043b\u044e\u0447\u0430\u044e\u0449\u0438\u0445 \u0441\u043b\u043e\u0436\u043d\u0443\u044e \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0443 \u0434\u0430\u043d\u043d\u044b\u0445 \u0438\u043b\u0438 \u0442\u0440\u0435\u0431\u0443\u044e\u0449\u0438\u0445 \u043e\u0434\u043d\u043e\u0432\u0440\u0435\u043c\u0435\u043d\u043d\u043e\u0433\u043e \u0432\u044b\u0431\u0440\u043e\u0441\u0430 \u0434\u0430\u043d\u043d\u044b\u0445 \u0438\u0437 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u0438\u0445 \u043a\u043e\u0440\u0443\u0442\u0438\u043d. \u041e\u0434\u043d\u0430\u043a\u043e \u0447\u0442\u043e \u0436\u0435 \u044d\u0442\u043e \u0442\u0430\u043a\u043e\u0435?<\/p>\n<p>  \u0420\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u0440\u0435\u0430\u043b\u044c\u043d\u044b\u0439 \u0441\u0446\u0435\u043d\u0430\u0440\u0438\u0439, \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u043c \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u043e\u0431\u0440\u0430\u0437\u0443\u044e\u0442 \u0441\u0432\u044f\u0437\u0430\u043d\u043d\u0443\u044e \u0441\u0435\u0442\u044c, \u043e\u0431\u043d\u0430\u0440\u0443\u0436\u0438\u0432\u0430\u044f \u0431\u043b\u0438\u0437\u043b\u0435\u0436\u0430\u0449\u0438\u0435 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f (\u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432\u0430) \u0447\u0435\u0440\u0435\u0437 Bluetooth \u0438\u043b\u0438 \u043b\u043e\u043a\u0430\u043b\u044c\u043d\u0443\u044e \u0441\u0435\u0442\u044c \u0438 \u043e\u0434\u043d\u043e\u0432\u0440\u0435\u043c\u0435\u043d\u043d\u043e \u043f\u043e\u043b\u0443\u0447\u0430\u044f \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044e \u043e \u0431\u043b\u0438\u0437\u043b\u0435\u0436\u0430\u0449\u0438\u0445 \u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432\u0430\u0445 \u0441 \u0443\u0434\u0430\u043b\u0451\u043d\u043d\u043e\u0433\u043e \u0441\u0435\u0440\u0432\u0435\u0440\u0430. \u0412 \u044d\u0442\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u043a\u0430\u0436\u0434\u043e\u043c\u0443 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044e \u043c\u043e\u0436\u0435\u0442 \u043f\u043e\u0442\u0440\u0435\u0431\u043e\u0432\u0430\u0442\u044c\u0441\u044f \u043e\u0442\u043f\u0440\u0430\u0432\u0438\u0442\u044c \u0434\u0430\u043d\u043d\u044b\u0435 \u0438\u0437 \u0442\u0440\u0451\u0445 \u0440\u0430\u0437\u043b\u0438\u0447\u043d\u044b\u0445 \u0438\u0441\u0442\u043e\u0447\u043d\u0438\u043a\u043e\u0432, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0440\u0430\u0431\u043e\u0442\u0430\u044e\u0442 \u043d\u0435\u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e \u0438 \u043d\u0435\u043f\u0440\u0435\u0440\u044b\u0432\u043d\u043e.<a name=\"habracut\"><\/a><\/p>\n<pre><code class=\"kotlin\">val nearbyDevices = channelFlow {     launch {         send(LANHelper.discoverConnectableHosts())     }      launch {         send(BluetoothHelper.discoverConnectableDevices())     }      launch {         send(NetworkHelper.getRegisteredDevices())     } }  \/\/ At the place you need the data nearbyDevices.collect { data ->     \/\/ Do something }<\/code><\/pre>\n<p>  \u0412\u0441\u0435 \u0442\u0440\u0438 \u0438\u0441\u0442\u043e\u0447\u043d\u0438\u043a\u0430 \u0436\u0438\u0432\u0443\u0442 \u0432 \u0441\u0432\u043e\u0438\u0445 \u0441\u043e\u0431\u0441\u0442\u0432\u0435\u043d\u043d\u044b\u0445 \u043a\u043e\u0440\u0443\u0442\u0438\u043d\u0430\u0445 \u0438 \u043f\u0435\u0440\u0435\u0434\u0430\u044e\u0442 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u0432 \u043e\u0434\u0438\u043d \u0438 \u0442\u043e\u0442 \u0436\u0435 \u043a\u0430\u043d\u0430\u043b, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043c\u043e\u0436\u043d\u043e \u043f\u043e\u0442\u0440\u0435\u0431\u043b\u044f\u0442\u044c \u0431\u0435\u0437 \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0445 \u0443\u0445\u0438\u0449\u0440\u0435\u043d\u0438\u0439.<\/p>\n<p>  \u041c\u043e\u0436\u043d\u043e \u043b\u0438 \u0434\u043e\u0431\u0438\u0442\u044c\u0441\u044f \u0430\u043d\u0430\u043b\u043e\u0433\u0438\u0447\u043d\u043e\u0433\u043e \u043f\u043e\u0432\u0435\u0434\u0435\u043d\u0438\u044f \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u043f\u0440\u043e\u0441\u0442\u043e\u0433\u043e <code>Flow<\/code>? \u0414\u0430, \u0432\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u0440\u0430\u0437\u0434\u0435\u043b\u0438\u0442\u044c \u0441\u0435\u0442\u0435\u0432\u044b\u0435 \u0437\u0430\u043f\u0440\u043e\u0441\u044b \u0438 \u043e\u0431\u043d\u0430\u0440\u0443\u0436\u0435\u043d\u0438\u0435 Bluetooth \u043d\u0430 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0440\u0430\u0437\u043b\u0438\u0447\u043d\u044b\u0445 \u043f\u043e\u0442\u043e\u043a\u043e\u0432, \u0430 \u0437\u0430\u0442\u0435\u043c \u043e\u0431\u044a\u0435\u0434\u0438\u043d\u0438\u0442\u044c \u0434\u0430\u043d\u043d\u044b\u0435 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u0441\u043f\u0435\u0446\u0438\u0430\u043b\u044c\u043d\u043e\u0439 \u0444\u0443\u043d\u043a\u0446\u0438\u0438.<\/p>\n<pre><code class=\"kotlin\">fun networkDataFlow() = flow {     emit(LANHelper.discoverConnectableHosts()) }  fun bluetoothDiscoveryFlow() = flow {     emit(BluetoothHelper.discoverConnectableDevices()) }  fun registeredDevicesNearbyFlow() = flow {     emit(NetworkHelper.getRegisteredDevices()) }  \/\/ At the place you need the data merge(     networkDataFlow(),     bluetoothDiscoveryFlow(),     registeredDevicesNearbyFlow() ) { networkData, bluetoothData, registeredDevices ->     \/\/ React to the data }.collect { combinedData ->     println(combinedData) }<\/code><\/pre>\n<p>  <i>\u0420\u0430\u0437\u043d\u0438\u0446\u0430 \u043f\u043e\u043a\u0430 \u0447\u0442\u043e \u043b\u0435\u0436\u0438\u0442 \u0441\u043a\u043e\u0440\u0435\u0435 \u043d\u0430 \u0443\u0440\u043e\u0432\u043d\u0435 \u0430\u0440\u0445\u0438\u0442\u0435\u043a\u0442\u0443\u0440\u044b.<\/i><\/p>\n<p>  \u0418\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435 \u043e\u0431\u043e\u0438\u0445 \u043d\u0430 \u0442\u0430\u043a\u0438\u0445 \u043f\u0440\u043e\u0441\u0442\u044b\u0445 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f\u0445 \u0431\u0443\u0434\u0435\u0442 \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u043e\u0434\u0438\u043d\u0430\u043a\u043e\u0432\u043e, \u0435\u0441\u043b\u0438 \u0443 \u0432\u0430\u0441 \u043d\u0435\u0442 \u0432\u044b\u0441\u043e\u043a\u043e\u0441\u043a\u043e\u0440\u043e\u0441\u0442\u043d\u043e\u0439 \u044d\u043c\u0438\u0441\u0441\u0438\u0438.<\/p>\n<p>  \u041f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u044c <code>Flow<\/code> \u0442\u0430\u043a\u0436\u0435 \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0432\u0430\u0436\u043d\u044b\u043c \u0444\u0430\u043a\u0442\u043e\u0440\u043e\u043c. \u042f \u043d\u0430\u0448\u0451\u043b \u043d\u0435\u043f\u043b\u043e\u0445\u0443\u044e <a href=\"https:\/\/medium.com\/mobile-app-development-publication\/kotlins-flow-channelflow-and-callbackflow-made-easy-5e82ce2e27c0\">\u0441\u0442\u0430\u0442\u044c\u044e<\/a> \u2014 \u0432 \u043d\u0435\u0439 \u043e\u043f\u0438\u0441\u0430\u043d\u043e \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u043e \u0441\u043b\u0443\u0447\u0430\u0435\u0432 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f <code>Flow<\/code> \u0438 <code>ChannelFlow<\/code>, \u0430 \u0442\u0430\u043a\u0436\u0435 \u043f\u0440\u0438\u0432\u0435\u0434\u0435\u043d\u044b \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0434\u0430\u043d\u043d\u044b\u0435 \u043e \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438.<\/p>\n<p>  \u0421\u043f\u0443\u0441\u0442\u044f \u0433\u043e\u0434 \u0441 \u043c\u043e\u043c\u0435\u043d\u0442\u0430 \u0432\u044b\u0445\u043e\u0434\u0430 \u0441\u0442\u0430\u0442\u044c\u0438 \u044f \u043f\u043e\u0432\u0442\u043e\u0440\u0438\u043b \u0442\u0435\u0441\u0442 \u043d\u0430 Pixel 7a (10 \u0440\u0430\u0437 \u0434\u043b\u044f \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u043f\u043e\u0442\u043e\u043a\u0430 \u0438 \u0437\u0430\u0442\u0435\u043c \u0432\u044b\u0447\u0438\u0441\u043b\u0438\u043b \u0441\u0440\u0435\u0434\u043d\u0435\u0435 \u0432\u0440\u0435\u043c\u044f \u0434\u043b\u044f \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u0437\u0430\u043f\u0443\u0441\u043a\u0430) \u0438 \u043f\u043e\u043b\u0443\u0447\u0438\u043b \u0430\u043d\u0430\u043b\u043e\u0433\u0438\u0447\u043d\u044b\u0435 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u044b (\u0442\u0430\u043a \u0447\u0442\u043e \u043d\u0438\u043a\u0430\u043a\u043e\u0439 \u043e\u043f\u0442\u0438\u043c\u0438\u0437\u0430\u0446\u0438\u0438 \u043d\u0435 \u043f\u0440\u043e\u0438\u0437\u043e\u0448\u043b\u043e\u2026 \u0445\u0435-\u0445\u0435).<\/p>\n<pre><code class=\"kotlin\">flow 1000      -> 0.012513591 10000     -> 0.091140584 100000    -> 0.411128418 1000000   -> 8.215107670 10000000  -> 40.605143168 100000000 -> 403.867435622  channelFlow 1000      -> 0.040344645 10000     -> 0.300058228 100000    -> 12.407572719 1000000   -> 106.307522798 10000000  -> 310.608283640 I stopped waiting after an hour of calculations :)<\/code><\/pre>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/webt\/6p\/56\/7t\/6p567tvhsiza4fclzjij8ukv9lq.png\" data-src=\"https:\/\/habrastorage.org\/webt\/6p\/56\/7t\/6p567tvhsiza4fclzjij8ukv9lq.png\"\/><\/p>\n<p>  \u041a\u0430\u043a \u0432\u0438\u0434\u0438\u0442\u0435, <code>channelFlow<\/code> \u0432 \u0442\u0440\u0438 \u0440\u0430\u0437\u0430 \u043c\u0435\u0434\u043b\u0435\u043d\u043d\u0435\u0435 \u0431\u0430\u0437\u043e\u0432\u043e\u0433\u043e <code>Flow<\/code> \u043d\u0430 1000 \u0432\u044b\u0431\u0440\u043e\u0441\u043e\u0432, \u0438 \u044d\u0442\u0430 \u0440\u0430\u0437\u043d\u0438\u0446\u0430 \u0440\u0430\u0441\u0442\u0451\u0442 \u0432 \u0433\u0435\u043e\u043c\u0435\u0442\u0440\u0438\u0447\u0435\u0441\u043a\u043e\u0439 \u043f\u0440\u043e\u0433\u0440\u0435\u0441\u0441\u0438\u0438.<\/p>\n<p>  \u041d\u043e\u2026 \u0422\u0430\u043a \u043b\u0438 \u044d\u0442\u043e \u0434\u043b\u044f \u043c\u043e\u0431\u0438\u043b\u044c\u043d\u043e\u0439 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0438? \u0415\u0441\u043b\u0438 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442 \u0441\u0442\u043e \u0442\u044b\u0441\u044f\u0447 \u0432\u044b\u0447\u0438\u0441\u043b\u0435\u043d\u0438\u0439 \u0432 \u0441\u0435\u043a\u0443\u043d\u0434\u0443 \u0438 \u043f\u0435\u0440\u0435\u0434\u0430\u0451\u0442 \u0438\u0445 \u043d\u0430 \u043f\u043e\u0442\u0440\u0435\u0431\u043b\u0435\u043d\u0438\u0435 \u2014 \u0432\u0435\u0440\u043e\u044f\u0442\u043d\u043e, \u0447\u0442\u043e-\u0442\u043e \u043d\u0435 \u0442\u0430\u043a. \u0412 \u0442\u0435\u0441\u0442\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043b\u0441\u044f \u043f\u0440\u0438\u043c\u0438\u0442\u0438\u0432\u043d\u044b\u0439 \u0442\u0438\u043f, \u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435 \u0440\u0435\u0430\u043b\u044c\u043d\u044b\u0445 \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u0432 \u0443\u0432\u0435\u043b\u0438\u0447\u0438\u0442 \u0432\u0440\u0435\u043c\u044f. \u041e\u0434\u043d\u043e \u0434\u0435\u043b\u043e \u2014 \u043f\u0435\u0440\u0435\u0434\u0430\u0442\u044c \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435, \u043d\u043e \u0438 \u043f\u043e\u0442\u0440\u0435\u0431\u043b\u044f\u0442\u044c \u0435\u0433\u043e \u043d\u0443\u0436\u043d\u043e \u0441 \u0442\u0430\u043a\u043e\u0439 \u0436\u0435 \u0441\u043a\u043e\u0440\u043e\u0441\u0442\u044c\u044e. \u0412 \u043f\u0440\u043e\u0442\u0438\u0432\u043d\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u043c\u044b \u0443\u0432\u0438\u0434\u0438\u043c \u0441\u043d\u0438\u0436\u0435\u043d\u0438\u0435 \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438 \u0432\u0441\u0435\u0433\u043e \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f. <\/p>\n<p>  \u0412\u043e\u0442 \u0447\u0442\u043e \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442 \u0432 \u043c\u0435\u043d\u044c\u0448\u0435\u043c \u043c\u0430\u0441\u0448\u0442\u0430\u0431\u0435 \u2014 \u043e\u0442 25 \u0434\u043e 1000 \u043f\u0435\u0440\u0435\u0434\u0430\u043d\u043d\u044b\u0445 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0439. \u042f \u0434\u043e\u0431\u0430\u0432\u0438\u043b \u043d\u0435\u0431\u043e\u043b\u044c\u0448\u0443\u044e \u0437\u0430\u0434\u0435\u0440\u0436\u043a\u0443 \u0432 10 \u043c\u0441, \u0438\u043c\u0438\u0442\u0438\u0440\u0443\u044e\u0449\u0443\u044e \u0441\u0435\u0442\u0435\u0432\u044b\u0435 \u0437\u0430\u043f\u0440\u043e\u0441\u044b, \u0447\u0442\u043e \u0432\u043b\u0438\u044f\u0435\u0442 \u043d\u0430 \u0441\u0438\u0442\u0443\u0430\u0446\u0438\u044e.<\/p>\n<p>  <a href=\"https:\/\/medium.com\/mobile-app-development-publication\/kotlins-flow-channelflow-and-callbackflow-made-easy-5e82ce2e27c0\">\u0412\u043e\u0442 \u043a\u043e\u0434 \u0438\u0437 \u0441\u0442\u0430\u0442\u044c\u0438<\/a>, \u043a\u043e\u0442\u043e\u0440\u0443\u044e \u044f \u0443\u043f\u043e\u043c\u0438\u043d\u0430\u043b, \u0441 \u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u043d\u043e\u0439 \u0437\u0430\u0434\u0435\u0440\u0436\u043a\u043e\u0439:<\/p>\n<pre><code class=\"kotlin\">val time = measureNanoTime {     channelFlow {         for (i in 1..count) {             send(i)             delay(10)         }     }.collect {} }<\/code><\/pre>\n<p>  \u0420\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442:<\/p>\n<pre><code class=\"kotlin\">flow 25   -> 0.270430624 50   -> 0.558355266 75   -> 0.859869426 100  -> 1.187430339 250  -> 3.382514854 500  -> 6.320075401 750  -> 10.442842698 1000 -> 13.770569424  channelFlow 25   -> 0.276624023 50   -> 0.591518759 75   -> 1.06053414 100  -> 1.362990153 250  -> 3.417985678 500  -> 7.18098564 750  -> 11.00395154 1000 -> 14.33561907<\/code><\/pre>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/webt\/0y\/1y\/yg\/0y1yygheylex8iuyx2oai8gw4ay.png\" data-src=\"https:\/\/habrastorage.org\/webt\/0y\/1y\/yg\/0y1yygheylex8iuyx2oai8gw4ay.png\"\/><\/p>\n<p>  \u0420\u0430\u0437\u043d\u0438\u0446\u0430 \u0437\u0430\u043c\u0435\u0442\u043d\u0430, \u0438 \u043e\u043d\u0430 \u043f\u0440\u0435\u0432\u044b\u0448\u0430\u0435\u0442 \u043f\u043e\u0440\u043e\u0433\u043e\u0432\u044b\u0439 \u0443\u0440\u043e\u0432\u0435\u043d\u044c \u0434\u043b\u044f \u0432\u044b\u0431\u0440\u043e\u0441\u0430 \u0431\u043e\u043b\u0435\u0435 100 \u0432 \u0441\u0435\u043a\u0443\u043d\u0434\u0443.<\/p>\n<p>  \u042f \u043d\u0430\u0448\u0451\u043b \u0445\u043e\u0440\u043e\u0448\u0438\u0439 \u043f\u0440\u0438\u043c\u0435\u0440, \u043a\u043e\u0433\u0434\u0430 <code>channelFlow<\/code> \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u043a\u0440\u0443\u0442. \u041e\u043d \u043f\u0440\u0438\u0448\u0451\u043b \u043c\u043d\u0435 \u0432 \u0433\u043e\u043b\u043e\u0432\u0443, \u043a\u043e\u0433\u0434\u0430 \u044f \u043f\u044b\u0442\u0430\u043b\u0441\u044f \u043d\u0430\u0439\u0442\u0438 \u0442\u043e, \u0447\u0442\u043e \u043c\u044b \u043d\u0435 \u043c\u043e\u0436\u0435\u043c \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e <code>Flow<\/code>.<\/p>\n<pre><code class=\"kotlin\">suspend fun launchAdditionalProducer(scope: ProducerScope&lt;String>) {     scope.launch {         repeat(5) { index ->             delay(50)             scope.send(\"Message $index from Main Additional Producer\")         }     } }  fun mainFlow() {     val channel = channelFlow {         launch {             repeat(20) { index ->                 delay(100)                 send(\"Message $index from Main Producer\")                 if (index == 2) {                     launchAdditionalProducer(this@channelFlow)                 }                 if (index >= 5) {                     cancel()                 }             }         }         launch {             repeat(20) { index ->                 delay(33)                 send(\"Message $index from Secondary Producer\")             }         }     }     CoroutineScope(Dispatchers.Default).launch {         channel.collect { value ->             println(value)         }     } }<\/code><\/pre>\n<p>  \u0412 \u044d\u0442\u043e\u043c \u043f\u0440\u0438\u043c\u0435\u0440\u0435 \u043a\u043e\u0434 \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0435\u0442 <code>channelFlow<\/code> \u0441 \u0434\u0432\u0443\u043c\u044f \u043a\u043e\u0440\u0443\u0442\u0438\u043d\u0430\u043c\u0438, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043f\u0435\u0440\u0435\u0434\u0430\u044e\u0442 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f. \u041a\u043e\u0433\u0434\u0430 \u043f\u0435\u0440\u0432\u0430\u044f \u043a\u043e\u0440\u0443\u0442\u0438\u043d\u0430 \u043e\u0442\u043f\u0440\u0430\u0432\u043b\u044f\u0435\u0442 \u00ab2\u00bb, \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0435\u0442\u0441\u044f \u043d\u043e\u0432\u0430\u044f \u043a\u043e\u0440\u0443\u0442\u0438\u043d\u0430 \u0438 \u043d\u0430\u0447\u0438\u043d\u0430\u0435\u0442 \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u044c \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f. \u0412 \u043c\u043e\u043c\u0435\u043d\u0442 \u00ab5\u00bb \u043f\u0435\u0440\u0432\u044b\u0439 \u00abMain producer\u00bb \u043e\u0442\u043c\u0435\u043d\u044f\u0435\u0442\u0441\u044f, \u0438 \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0439 producer \u043e\u0442\u043c\u0435\u043d\u044f\u0435\u0442\u0441\u044f \u0432\u043c\u0435\u0441\u0442\u0435 \u0441 \u0433\u043b\u0430\u0432\u043d\u043e\u0439 \u043a\u043e\u0440\u0443\u0442\u0438\u043d\u043e\u0439.<\/p>\n<pre><code class=\"kotlin\">19:03:53.254  I  Message 0 from Secondary Producer    &lt;- Secondary producer ~3 times faster than Main producer 19:03:53.289  I  Message 1 from Secondary Producer  19:03:53.322  I  Message 0 from Main Producer             19:03:53.325  I  Message 2 from Secondary Producer 19:03:53.359  I  Message 3 from Secondary Producer 19:03:53.394  I  Message 4 from Secondary Producer 19:03:53.424  I  Message 1 from Main Producer 19:03:53.429  I  Message 5 from Secondary Producer 19:03:53.464  I  Message 6 from Secondary Producer 19:03:53.504  I  Message 7 from Secondary Producer 19:03:53.525  I  Message 2 from Main Producer  &lt;-- Additional coroutine launches 19:03:53.538  I  Message 8 from Secondary Producer 19:03:53.572  I  Message 9 from Secondary Producer 19:03:53.577  I  Message 0 from Main Additional Producer 19:03:53.606  I  Message 10 from Secondary Producer 19:03:53.626  I  Message 3 from Main Producer 19:03:53.628  I  Message 1 from Main Additional Producer 19:03:53.641  I  Message 11 from Secondary Producer 19:03:53.676  I  Message 12 from Secondary Producer 19:03:53.681  I  Message 2 from Main Additional Producer 19:03:53.711  I  Message 13 from Secondary Producer 19:03:53.728  I  Message 4 from Main Producer 19:03:53.733  I  Message 3 from Main Additional Producer 19:03:53.745  I  Message 14 from Secondary Producer 19:03:53.781  I  Message 15 from Secondary Producer 19:03:53.792  I  Message 4 from Main Additional Producer 19:03:53.815  I  Message 16 from Secondary Producer 19:03:53.837  I  Message 5 from Main Producer &lt;- Main producer and Additional coroutine get cancelled. 19:03:53.852  I  Message 17 from Secondary Producer 19:03:53.889  I  Message 18 from Secondary Producer 19:03:53.924  I  Message 19 from Secondary Producer<\/code><\/pre>\n<p>  \u042d\u0442\u043e, \u043f\u043e\u0436\u0430\u043b\u0443\u0439, \u0441\u0430\u043c\u044b\u0439 \u0432\u0430\u0436\u043d\u044b\u0439 \u043c\u043e\u043c\u0435\u043d\u0442. <code>ChannelFlow<\/code> \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0430\u043c \u043d\u0435 \u0442\u043e\u043b\u044c\u043a\u043e \u0430\u0441\u0438\u043d\u0445\u0440\u043e\u043d\u043d\u043e \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u044c \u0434\u0430\u043d\u043d\u044b\u0435 \u0438\u0437 \u0440\u0430\u0437\u043d\u044b\u0445 \u0438\u0441\u0442\u043e\u0447\u043d\u0438\u043a\u043e\u0432, \u043d\u043e \u0438 \u0434\u0430\u0451\u0442 \u043f\u043e\u043b\u043d\u044b\u0439 \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u044c \u043d\u0430\u0434 \u0442\u0435\u043c, \u043a\u0430\u043a \u0434\u043e\u043b\u0436\u043d\u044b \u0432\u044b\u0433\u043b\u044f\u0434\u0435\u0442\u044c \u0436\u0438\u0437\u043d\u0435\u043d\u043d\u044b\u0435 \u0446\u0438\u043a\u043b\u044b \u043a\u043e\u0440\u0443\u0442\u0438\u043d\u043e\u0432 \u043d\u0435\u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e \u0434\u0440\u0443\u0433 \u043e\u0442 \u0434\u0440\u0443\u0433\u0430. \u0412 \u0441\u043b\u0443\u0447\u0430\u0435 <code>ChannelFlow<\/code> \u043c\u043e\u0436\u043d\u043e \u0433\u0438\u0431\u043a\u043e \u0431\u0430\u043b\u0430\u043d\u0441\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043d\u0430\u0433\u0440\u0443\u0437\u043a\u0443 \u043d\u0430 \u043e\u0431\u043e\u0440\u0443\u0434\u043e\u0432\u0430\u043d\u0438\u0435 \u0432\u043e \u0432\u0440\u0435\u043c\u044f \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f. \u0412 \u0442\u043e \u0436\u0435 \u0432\u0440\u0435\u043c\u044f <code>Flow<\/code> \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442 \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u044b\u0439 \u043c\u0435\u0445\u0430\u043d\u0438\u0437\u043c \u043f\u0430\u0440\u0430\u043b\u043b\u0435\u043b\u0438\u0437\u043c\u0430 \u0438 \u0430\u0441\u0438\u043d\u0445\u0440\u043e\u043d\u043d\u043e\u0433\u043e \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u044f, \u0437\u0430\u0449\u0438\u0449\u0451\u043d\u043d\u044b\u0439 \u043e\u0442 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0430. <\/p>\n<p>  \u0422\u0430\u043a \u043f\u043e\u0447\u0435\u043c\u0443 \u0436\u0435 \u043f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f <code>Flow<\/code>, \u0430 \u043d\u0435 <code>ChannelFlow<\/code>?<\/p>\n<ul>\n<li>\u041e\u043d \u0431\u044b\u0441\u0442\u0440\u0435\u0435 \u043d\u0430 \u0432\u044b\u0441\u043e\u043a\u043e\u0441\u043a\u043e\u0440\u043e\u0441\u0442\u043d\u044b\u0445 \u044d\u043c\u0438\u0441\u0441\u0438\u044f\u0445.<\/li>\n<li>\u041d\u0435 \u043f\u0440\u0438\u0445\u043e\u0434\u0438\u0442\u0441\u044f \u0434\u043e\u043b\u0433\u043e \u0434\u0443\u043c\u0430\u0442\u044c \u043e \u043f\u043e\u0432\u0435\u0434\u0435\u043d\u0438\u0438 \u043f\u043e\u0442\u043e\u043a\u043e\u0432 \u0434\u0430\u043d\u043d\u044b\u0445.<\/li>\n<li>\u0415\u0433\u043e \u043f\u043e\u0432\u0435\u0434\u0435\u043d\u0438\u0435 \u0438 \u0436\u0438\u0437\u043d\u0435\u043d\u043d\u044b\u0439 \u0446\u0438\u043a\u043b \u0442\u0430\u043a\u0438\u0435 \u0436\u0435, \u043a\u0430\u043a \u0438 \u0443 \u043b\u044e\u0431\u043e\u0439 \u0434\u0440\u0443\u0433\u043e\u0439 \u0431\u0430\u0437\u043e\u0432\u043e\u0439 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u0432 Kotlin. \u0415\u0441\u043b\u0438 \u0432\u044b \u0432\u0438\u0434\u0438\u0442\u0435 <code>flow {}<\/code>, \u0432\u044b \u0437\u043d\u0430\u0435\u0442\u0435, \u0447\u0442\u043e \u0432\u0441\u0435 \u043e\u043d\u0438 \u0432\u0435\u0434\u0443\u0442 \u0441\u0435\u0431\u044f \u043e\u0434\u0438\u043d\u0430\u043a\u043e\u0432\u043e. <code>ChannelFlow<\/code>, \u0432 \u0442\u043e \u0436\u0435 \u0432\u0440\u0435\u043c\u044f, \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0441\u0438\u0433\u043d\u0430\u043b\u043e\u043c, \u0447\u0442\u043e \u0437\u0434\u0435\u0441\u044c \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u0441\u043b\u043e\u0436\u043d\u0430\u044f \u043b\u043e\u0433\u0438\u043a\u0430 \u0438\u043b\u0438 \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0430 \u043a\u043e\u0440\u0443\u0442\u0438\u043d\u043e\u0432, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u044f\u0442 \u043e\u0434\u0438\u043d \u043f\u043e\u0442\u043e\u043a \u0434\u0430\u043d\u043d\u044b\u0445.<\/li>\n<li>\u041f\u043e\u0442\u0435\u043d\u0446\u0438\u0430\u043b\u044c\u043d\u043e \u044d\u0442\u043e \u0441\u043b\u043e\u0436\u043d\u0435\u0435 \u043f\u0440\u043e\u0432\u0435\u0440\u0438\u0442\u044c.<\/li>\n<\/ul>\n<p>  \u041f\u043e\u0434\u0435\u043b\u0438\u0442\u0435\u0441\u044c, \u043a\u0430\u043a \u0432\u044b \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0435 ChannelFlow \u0438 \u043f\u043e\u0447\u0435\u043c\u0443.<\/p>\n<p>  <a href=\"https:\/\/otus.pw\/CMcX\/\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/webt\/qt\/mz\/yf\/qtmzyfwkrn1snee-zgcykifv7yq.png\" data-src=\"https:\/\/habrastorage.org\/webt\/qt\/mz\/yf\/qtmzyfwkrn1snee-zgcykifv7yq.png\"\/><\/a><\/div>\n<\/div>\n<\/div>\n<p><!----><!----><\/div>\n<p><!----><!----><br \/> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"https:\/\/habr.com\/ru\/articles\/801907\/\"> https:\/\/habr.com\/ru\/articles\/801907\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<div><!--[--><!--]--><\/div>\n<div id=\"post-content-body\">\n<div>\n<div class=\"article-formatted-body article-formatted-body article-formatted-body_version-1\">\n<div xmlns=\"http:\/\/www.w3.org\/1999\/xhtml\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/webt\/jf\/a_\/nc\/jfa_ncv1oww95d2fkuaaxb0yjhs.png\" data-src=\"https:\/\/habrastorage.org\/webt\/jf\/a_\/nc\/jfa_ncv1oww95d2fkuaaxb0yjhs.png\"\/><\/p>\n<p>  \u042f \u0437\u043d\u0430\u044e, \u0447\u0442\u043e \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u0435\u0442 \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u043e \u0441\u0442\u0430\u0442\u0435\u0439 \u043e <code>flow<\/code> \u0438 <code>channelFlow<\/code>, \u0432 \u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u0447\u0430\u0441\u0442\u043e \u043f\u043e\u0434\u0447\u0451\u0440\u043a\u0438\u0432\u0430\u0435\u0442\u0441\u044f, \u0447\u0442\u043e <code>channelFlow<\/code> \u043f\u043e \u0441\u0443\u0442\u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442 <code>Channel<\/code>. \u041d\u043e \u0447\u0442\u043e \u044d\u0442\u043e \u043d\u0430 \u0441\u0430\u043c\u043e\u043c \u0434\u0435\u043b\u0435 \u0437\u043d\u0430\u0447\u0438\u0442 \u0434\u043b\u044f \u043c\u043e\u0431\u0438\u043b\u044c\u043d\u044b\u0445 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u043e\u0432? \u041a\u043e\u0433\u0434\u0430 \u044d\u0442\u043e \u0440\u0430\u0437\u043b\u0438\u0447\u0438\u0435 \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u0438\u043c\u0435\u0435\u0442 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435? \u041c\u043e\u0436\u043d\u043e \u043b\u0438 \u0434\u043e\u0431\u0438\u0442\u044c\u0441\u044f \u0442\u0430\u043a\u043e\u0433\u043e \u0436\u0435 \u043f\u043e\u0432\u0435\u0434\u0435\u043d\u0438\u044f \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e <code>flow<\/code> \u0431\u0435\u0437 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f <code>Channel<\/code>, \u0438 \u043a\u0430\u043a\u0438\u0435 \u0443\u043d\u0438\u043a\u0430\u043b\u044c\u043d\u044b\u0435 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u0438 \u043f\u0440\u0435\u0434\u043b\u0430\u0433\u0430\u0435\u0442 <code>ChannelFlow<\/code>, \u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u043d\u0435\u043b\u044c\u0437\u044f \u0434\u043e\u0441\u0442\u0438\u0447\u044c \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u043e\u0431\u044b\u0447\u043d\u043e\u0433\u043e <code>Flow<\/code>?<\/p>\n<p>  \u041a\u043b\u044e\u0447 \u043a \u044d\u0442\u043e\u043c\u0443 \u0432\u043e\u043f\u0440\u043e\u0441\u0443 \u043b\u0435\u0436\u0438\u0442 \u0432 \u043f\u043e\u043d\u0438\u043c\u0430\u043d\u0438\u0438 \u043e\u0441\u043d\u043e\u0432\u043d\u043e\u0439 \u043a\u043e\u043d\u0446\u0435\u043f\u0446\u0438\u0438 <code>Channel<\/code>. \u041a\u043e\u043d\u0446\u0435\u043f\u0442\u0443\u0430\u043b\u044c\u043d\u043e <code>Channel<\/code> \u0438 <code>Flow<\/code> \u0441\u043b\u0443\u0436\u0430\u0442 \u0440\u0430\u0437\u043d\u044b\u043c \u0446\u0435\u043b\u044f\u043c. \u041a\u0430\u043d\u0430\u043b\u044b (Channels) \u043e\u0431\u043b\u0435\u0433\u0447\u0430\u044e\u0442 \u0432\u0437\u0430\u0438\u043c\u043e\u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0435 \u043c\u0435\u0436\u0434\u0443 \u043a\u043e\u0440\u0443\u0442\u0438\u043d\u0430\u043c\u0438, \u0432 \u0442\u043e \u0432\u0440\u0435\u043c\u044f \u043a\u0430\u043a \u043f\u043e\u0442\u043e\u043a\u0438 (Flows) \u0431\u043e\u043b\u044c\u0448\u0435 \u043d\u0430\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u044b \u043d\u0430 \u044d\u0444\u0444\u0435\u043a\u0442\u0438\u0432\u043d\u043e\u0435 \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0441\u0442\u0432\u043e \u0438 \u0440\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u0435 \u0434\u0430\u043d\u043d\u044b\u0445.<\/p>\n<p>  <code>ChannelFlow<\/code> \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442 <code>Channel<\/code> \u0434\u043b\u044f \u0441\u0432\u043e\u0438\u0445 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0439, \u0447\u0442\u043e \u0434\u0435\u043b\u0430\u0435\u0442 \u0435\u0433\u043e \u043c\u043e\u0449\u043d\u044b\u043c \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442\u043e\u043c \u0432 \u0441\u0446\u0435\u043d\u0430\u0440\u0438\u044f\u0445, \u0432\u043a\u043b\u044e\u0447\u0430\u044e\u0449\u0438\u0445 \u0441\u043b\u043e\u0436\u043d\u0443\u044e \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0443 \u0434\u0430\u043d\u043d\u044b\u0445 \u0438\u043b\u0438 \u0442\u0440\u0435\u0431\u0443\u044e\u0449\u0438\u0445 \u043e\u0434\u043d\u043e\u0432\u0440\u0435\u043c\u0435\u043d\u043d\u043e\u0433\u043e \u0432\u044b\u0431\u0440\u043e\u0441\u0430 \u0434\u0430\u043d\u043d\u044b\u0445 \u0438\u0437 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u0438\u0445 \u043a\u043e\u0440\u0443\u0442\u0438\u043d. \u041e\u0434\u043d\u0430\u043a\u043e \u0447\u0442\u043e \u0436\u0435 \u044d\u0442\u043e \u0442\u0430\u043a\u043e\u0435?<\/p>\n<p>  \u0420\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u0440\u0435\u0430\u043b\u044c\u043d\u044b\u0439 \u0441\u0446\u0435\u043d\u0430\u0440\u0438\u0439, \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u043c \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u043e\u0431\u0440\u0430\u0437\u0443\u044e\u0442 \u0441\u0432\u044f\u0437\u0430\u043d\u043d\u0443\u044e \u0441\u0435\u0442\u044c, \u043e\u0431\u043d\u0430\u0440\u0443\u0436\u0438\u0432\u0430\u044f \u0431\u043b\u0438\u0437\u043b\u0435\u0436\u0430\u0449\u0438\u0435 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f (\u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432\u0430) \u0447\u0435\u0440\u0435\u0437 Bluetooth \u0438\u043b\u0438 \u043b\u043e\u043a\u0430\u043b\u044c\u043d\u0443\u044e \u0441\u0435\u0442\u044c \u0438 \u043e\u0434\u043d\u043e\u0432\u0440\u0435\u043c\u0435\u043d\u043d\u043e \u043f\u043e\u043b\u0443\u0447\u0430\u044f \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044e \u043e \u0431\u043b\u0438\u0437\u043b\u0435\u0436\u0430\u0449\u0438\u0445 \u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432\u0430\u0445 \u0441 \u0443\u0434\u0430\u043b\u0451\u043d\u043d\u043e\u0433\u043e \u0441\u0435\u0440\u0432\u0435\u0440\u0430. \u0412 \u044d\u0442\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u043a\u0430\u0436\u0434\u043e\u043c\u0443 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044e \u043c\u043e\u0436\u0435\u0442 \u043f\u043e\u0442\u0440\u0435\u0431\u043e\u0432\u0430\u0442\u044c\u0441\u044f \u043e\u0442\u043f\u0440\u0430\u0432\u0438\u0442\u044c \u0434\u0430\u043d\u043d\u044b\u0435 \u0438\u0437 \u0442\u0440\u0451\u0445 \u0440\u0430\u0437\u043b\u0438\u0447\u043d\u044b\u0445 \u0438\u0441\u0442\u043e\u0447\u043d\u0438\u043a\u043e\u0432, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0440\u0430\u0431\u043e\u0442\u0430\u044e\u0442 \u043d\u0435\u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e \u0438 \u043d\u0435\u043f\u0440\u0435\u0440\u044b\u0432\u043d\u043e.<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[],"class_list":["post-371443","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/371443","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=371443"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/371443\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=371443"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=371443"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=371443"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}