{"id":3037,"date":"2025-02-26T12:54:12","date_gmt":"2025-02-26T03:54:12","guid":{"rendered":"https:\/\/www.spread1.co.jp\/wp\/?p=3037"},"modified":"2025-02-26T12:54:16","modified_gmt":"2025-02-26T03:54:16","slug":"post-3037","status":"publish","type":"post","link":"https:\/\/www.spread1.co.jp\/wp\/post-3037\/","title":{"rendered":"\u65b0SkyWay\u306eSubscribe\u306f\u9806\u756a\u306b"},"content":{"rendered":"\n<p><strong>\u65b0SkyWay\u306f\u5b9f\u88c5\u304c\u3057\u3084\u3059\u304f\u306a\u3063\u305f<\/strong><\/p>\n\n\n\n<p>SkyWay\u306e\u30e9\u30a4\u30d6\u30e9\u30ea\u304c\u4e00\u65b0\u3055\u308c\u3001\u5f0a\u793e\u3067\u306f\u65e7SkyWay\u3067\u69cb\u7bc9\u3055\u308c\u305f\u30b7\u30b9\u30c6\u30e0\u3092\u65b0SkyWay\u3078\u30ea\u30d7\u30ec\u30fc\u30b9\u3059\u308b\u958b\u767a\u3092\u9032\u3081\u3066\u304a\u308a\u307e\u3059\u3002<\/p>\n\n\n\n<p>\u65b0SkyWay\u3067\u306fPubSub\u30e2\u30c7\u30eb\u304c\u63a1\u7528\u3055\u308c\u3001\u7279\u306b\uff13\u4eba\u4ee5\u4e0a\u3067\u306e\u591a\u4eba\u6570\u901a\u8a71\u30b7\u30b9\u30c6\u30e0\u3092\u975e\u5e38\u306b\u958b\u767a\u3057\u3084\u3059\u304f\u306a\u308a\u307e\u3057\u305f\u3002<\/p>\n\n\n\n<p>\u307e\u305f\u6620\u50cf\u30fb\u97f3\u58f0\u30fb\u30c7\u30fc\u30bf\u3092\u305d\u308c\u305e\u308cPublish\u30fbSubscribe\u3067\u304d\u308b\u3088\u3046\u306b\u306a\u3063\u305f\u3053\u3068\u3067\u3001<br>\u300c\u8a71\u3057\u3066\u3044\u308b\u4eba\u306e\u97f3\u58f0\u306f\u5168\u54e1\u304c\u53d7\u4fe1\u3059\u308b\u304c\u3001\u6620\u50cf\u306f\u5e0c\u671b\u8005\u306e\u307f\u53d7\u4fe1\u3059\u308b\u300d\u3068\u3044\u3063\u305f\u3088\u3046\u306a\u67d4\u8edf\u306a\u5236\u5fa1\u3082\u3057\u3084\u3059\u304f\u306a\u3063\u3066\u3044\u307e\u3059\u3002\u3057\u304b\u3057\u3001\u3001<\/p>\n\n\n\n<p><strong>Subscribe\u304c\u7d42\u308f\u3089\u306a\u3044\uff1f<\/strong><\/p>\n\n\n\n<p>\u65b0SkyWay\u306eAPI\u306b\u306f\u3044\u305a\u308c\u304b\u306e\u30e6\u30fc\u30b6\u30fc\u304c\u30e1\u30c7\u30a3\u30a2\u3084\u30c7\u30fc\u30bf\u3092Publish\u3057\u305f\u4e8b\u3092\u77e5\u3089\u305b\u308b\u30a4\u30d9\u30f3\u30c8\u304c\u3042\u308a\u307e\u3059\u3002<br>\u3042\u308b\u30d7\u30ed\u30b8\u30a7\u30af\u30c8\u3067\u306f\u305d\u306e\u30a4\u30d9\u30f3\u30c8\u30ea\u30b9\u30ca\u3067\u76f4\u63a5Publication\u3092Subscribe\u3057\u3066\u3044\u307e\u3057\u305f\u304c\u3001\u305d\u3053\u3067\u884c\u3063\u3066\u3044\u308bSubscribe\u51e6\u7406\u304c\u78ba\u7387\u7684\u306b\u30cf\u30f3\u30b0\u3059\u308b\u4e8b\u304c\u3042\u308a\u307e\u3057\u305f\u3002<br>\u305d\u306e\u6642\u306e\u5b9f\u88c5\u306f\u4ee5\u4e0b\u306e\u3088\u3046\u306a\u5f62\u3067\u3059\u3002<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"kotlin\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">import kotlinx.coroutines.CoroutineScope\nimport kotlinx.coroutines.Dispatchers\n\nval scope = CoroutineScope(Dispatchers.IO)\n\nroom.onStreamPublishedHandler = { pub ->\n    \/\/ \u3044\u305a\u308c\u304b\u306eStream\u304cPublish\u3055\u308c\u305f\n\n    scope.launch {\n        val sub = localRoomMember.subscribe(pub.id) \/\/ \u2190\u3053\u3053\u3067subscribe\u304c\u7d42\u308f\u3089\u306a\u3044\u4e8b\u304c\u3042\u308b\n        \/\/ do something...\n    }\n}<\/pre>\n\n\n\n<p><strong>\u554f\u984c\u70b9<\/strong><\/p>\n\n\n\n<p>\u4e0a\u8a18\u306e\u3088\u3046\u306a\u5b9f\u88c5\u3067\u306f\u3001\uff11\u3064\u306eSubscribe\u304c\u51e6\u7406\u3055\u308c\u3066\u3044\u308b\u6700\u4e2d\u306b\u5225\u306eSubscribe\u304c\u4e26\u884c\u7a3c\u50cd\u3059\u308b\u53ef\u80fd\u6027\u304c\u3042\u308a\u307e\u3059\u3002<br>\u3053\u306e\u30d1\u30bf\u30fc\u30f3\u306b\u9665\u3063\u305f\u3068\u304d\u3001Subscribe\u304c\u5b8c\u4e86\u3057\u306a\u304f\u306a\u3063\u3066\u3057\u307e\u3046\u3088\u3046\u3067\u3057\u305f\u3002<\/p>\n\n\n\n<p><strong>\u6539\u5584\u7b56<\/strong><\/p>\n\n\n\n<p>\u8907\u6570\u306esubscribe\u304c\u4e26\u884c\u7a3c\u50cd\u3057\u306a\u3044\u3088\u3046\u3001\u4ee5\u4e0b\u306e\u3088\u3046\u306a\u6539\u4fee\u3092\u884c\u3044\u307e\u3057\u305f\u3002<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"kotlin\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">import kotlinx.coroutines.CoroutineScope\nimport kotlinx.coroutines.Dispatchers\nimport kotlinx.coroutines.sync.Mutex\n\nval scope = CoroutineScope(Dispatchers.IO)\nval subscribingMutex = Mutex()\n\nroom.onStreamPublishedHandler = { pub ->\n    \/\/ \u3044\u305a\u308c\u304b\u306eStream\u304cPublish\u3055\u308c\u305f\n\n    scope.launch {\n        subscribingMutex.withLock {\n            val sub = localRoomMember.subscribe(pub.id) \/\/ \u2190\u5b89\u5b9a\u3057\u3066subscribe\u3067\u304d\u308b\u3088\u3046\u306b\u306a\u3063\u305f\n            \/\/ do something...\n        }\n    }\n}<\/pre>\n\n\n\n<p>\u30dd\u30a4\u30f3\u30c8\u3068\u306a\u308b\u306e\u306f12\u884c\u76ee\u306eMutex.withLock\u3067\u3059\u3002<br>onStreamPublishedHandler\u304c\u4e26\u884c\u7a3c\u50cd\u3057\u305f\u3068\u3057\u3066\u3082\u3001subscribingMutex.withLock\u306e\u30d6\u30ed\u30c3\u30af\u3092\u8907\u6570\u306e\u30b9\u30ec\u30c3\u30c9\u304c\u540c\u6642\u306b\u5b9f\u884c\u3059\u308b\u3053\u3068\u306f\u3067\u304d\u307e\u305b\u3093\u3002<br>\u3082\u3057\u3082\u8a72\u5f53\u30d6\u30ed\u30c3\u30af\u3092\u51e6\u7406\u3057\u3066\u3044\u308b\u6700\u4e2d\u306b\u5f8c\u7d9a\u306e\u30b9\u30ec\u30c3\u30c9\u304c\u305d\u3053\u3078\u5230\u9054\u3057\u305f\u5834\u5408\u3001\u5f8c\u7d9a\u306e\u30b9\u30ec\u30c3\u30c9\u306f\u524d\u306e\u30b9\u30ec\u30c3\u30c9\u304c\u51e6\u7406\u3092\u5b8c\u4e86\u3059\u308b\u307e\u3067\u5f85\u3064\u3053\u3068\u306b\u306a\u308a\u3001subscribe\u304c\u4e00\u3064\u4e00\u3064\u9806\u756a\u306b\u51e6\u7406\u3055\u308c\u307e\u3059\u3002<br>\u4e00\u898b\u3059\u308b\u3068\u4e26\u884c\u7a3c\u50cd\u3059\u308b\u3088\u308a\u3082\u5168\u4f53\u306e\u51e6\u7406\u6642\u9593\u304c\u304b\u304b\u3063\u3066\u3057\u307e\u3046\u3088\u3046\u306b\u611f\u3058\u307e\u3059\u304c\u3001\u3053\u308c\u306b\u3088\u3063\u3066Subscribe\u304c\u30cf\u30f3\u30b0\u3059\u308b\u78ba\u7387\u3092\u660e\u3089\u304b\u306b\u4e0b\u3052\u3001\u63a5\u7d9a\u51e6\u7406\u306b\u304b\u304b\u308b\u6642\u9593\u3084\u5b89\u5b9a\u6027\u3092\u6539\u5584\u3067\u304d\u307e\u3057\u305f\u3002<\/p>\n\n\n\n<p><strong>\u307e\u3068\u3081<\/strong><\/p>\n\n\n\n<p>Mutex\u3092\u7528\u3044\u308b\u3053\u3068\u3067\u975e\u540c\u671f\u51e6\u7406\u306e\u9806\u5e8f\u3092\u6574\u7406\u3059\u308b\u3053\u3068\u304c\u3067\u304d\u3001\u305d\u308c\u306b\u3088\u3063\u3066\u51e6\u7406\u3092\u5b89\u5b9a\u3055\u305b\u308b\u4e8b\u304c\u3067\u304d\u307e\u3059\u3002<br>\u65b0SkyWay\u306esubscribe\u51e6\u7406\u306b\u304a\u3044\u3066\u306f\u3001\u3053\u308c\u306f\u975e\u5e38\u306b\u52b9\u679c\u7684\u3067\u3057\u305f\u3002<\/p>\n\n\n\n<p>\u5f0a\u793e\u3067\u306fWebRTC\u958b\u767a\u6848\u4ef6\u3082\u627f\u3063\u3066\u304a\u308a\u307e\u3059\u306e\u3067\u3001\u554f\u3044\u5408\u308f\u305b\u30d5\u30a9\u30fc\u30e0\u3088\u308a\u304a\u6c17\u8efd\u306b\u3054\u76f8\u8ac7\u304f\u3060\u3055\u3044\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u65b0SkyWay\u306f\u5b9f\u88c5\u304c\u3057\u3084\u3059\u304f\u306a\u3063\u305f SkyWay\u306e\u30e9\u30a4\u30d6\u30e9\u30ea\u304c\u4e00\u65b0\u3055\u308c\u3001\u5f0a\u793e\u3067\u306f\u65e7SkyWay\u3067\u69cb\u7bc9\u3055\u308c\u305f\u30b7\u30b9\u30c6\u30e0\u3092\u65b0SkyWay\u3078\u30ea\u30d7\u30ec\u30fc\u30b9\u3059\u308b\u958b\u767a\u3092\u9032\u3081\u3066\u304a\u308a\u307e\u3059\u3002 \u65b0SkyWay\u3067\u306fPubSub\u30e2\u30c7\u30eb\u304c\u63a1\u7528\u3055\u308c\u3001 [&hellip;]<\/p>\n","protected":false},"author":6,"featured_media":3072,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[46,33],"tags":[49,45],"class_list":["post-3037","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-webrtc","category-33","tag-skyway","tag-webrtc"],"_links":{"self":[{"href":"https:\/\/www.spread1.co.jp\/wp\/wp-json\/wp\/v2\/posts\/3037","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.spread1.co.jp\/wp\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.spread1.co.jp\/wp\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.spread1.co.jp\/wp\/wp-json\/wp\/v2\/users\/6"}],"replies":[{"embeddable":true,"href":"https:\/\/www.spread1.co.jp\/wp\/wp-json\/wp\/v2\/comments?post=3037"}],"version-history":[{"count":2,"href":"https:\/\/www.spread1.co.jp\/wp\/wp-json\/wp\/v2\/posts\/3037\/revisions"}],"predecessor-version":[{"id":3039,"href":"https:\/\/www.spread1.co.jp\/wp\/wp-json\/wp\/v2\/posts\/3037\/revisions\/3039"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.spread1.co.jp\/wp\/wp-json\/wp\/v2\/media\/3072"}],"wp:attachment":[{"href":"https:\/\/www.spread1.co.jp\/wp\/wp-json\/wp\/v2\/media?parent=3037"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.spread1.co.jp\/wp\/wp-json\/wp\/v2\/categories?post=3037"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.spread1.co.jp\/wp\/wp-json\/wp\/v2\/tags?post=3037"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}