[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"project-7380":3},{"id":4,"name":5,"fullName":6,"owner":7,"repo":5,"description":8,"homepage":9,"htmlUrl":10,"language":11,"languages":10,"totalLinesOfCode":10,"stars":12,"forks":13,"watchers":14,"openIssues":15,"contributorsCount":16,"subscribersCount":16,"size":16,"stars1d":16,"stars7d":16,"stars30d":16,"stars90d":16,"forks30d":16,"starsTrendScore":16,"compositeScore":17,"rankGlobal":10,"rankLanguage":10,"license":18,"archived":19,"fork":19,"defaultBranch":20,"hasWiki":21,"hasPages":19,"topics":22,"createdAt":10,"pushedAt":10,"updatedAt":23,"readmeContent":24,"aiSummary":25,"trendingCount":16,"starSnapshotCount":16,"syncStatus":26,"lastSyncTime":27,"discoverSource":28},7380,"Scarlet","Tinder\u002FScarlet","Tinder","A Retrofit inspired WebSocket client for Kotlin, Java, and Android","",null,"Kotlin",3257,243,54,99,0,59.16,"Other",false,"main",true,[],"2026-06-12 04:00:33","Scarlet\n===\n[![CircleCI](https:\u002F\u002Fcircleci.com\u002Fgh\u002FTinder\u002FScarlet.svg?style=svg)](https:\u002F\u002Fcircleci.com\u002Fgh\u002FTinder\u002FScarlet)\n\nA Retrofit inspired WebSocket client for Kotlin, Java, and Android.\n\nUpdate\n---\nWe are working on a new version of Scarlet that supports other persistent connection protocols: ServerSentEvent, Socket IO, STOMP, and MQTT. It can be found on the [`0.2.x`](https:\u002F\u002Fgithub.com\u002FTinder\u002FScarlet\u002Ftree\u002F0.2.x) branch.\n\n\nTutorial\n---\n- [Taming WebSocket with Scarlet][tutorial]\n- [A talk][slides] at [Conference for Kotliners][kotliners]\n\nUsage\n---\nIn this example, we read the realtime Bitcoin price from [Gdax WebSocket Feed][gdax-websocket-feed].\nFor more information, please check out the [demo app][demo-app].\n\nDeclare a WebSocket client using an interface:\n\n~~~ kotlin\ninterface GdaxService {\n\t@Receive\n\tfun observeWebSocketEvent(): Flowable\u003CWebSocket.Event>\n\t@Send\n\tfun sendSubscribe(subscribe: Subscribe)\n\t@Receive\n \tfun observeTicker(): Flowable\u003CTicker>\n}\n~~~\n\nUse Scarlet to create an implementation:\n\n~~~ kotlin\nval scarletInstance = Scarlet.Builder()\n    .webSocketFactory(okHttpClient.newWebSocketFactory(\"wss:\u002F\u002Fws-feed.gdax.com\"))\n    .addMessageAdapterFactory(MoshiMessageAdapter.Factory())\n    .addStreamAdapterFactory(RxJava2StreamAdapterFactory())\n    .build()\n\nval gdaxService = scarletInstance.create\u003CGdaxService>()\n~~~\n\nSend a `Subscribe` message upon connection open and the server will start streaming tickers which contain the latest price.\n\n\n~~~ kotlin\nval BITCOIN_TICKER_SUBSCRIBE_MESSAGE = Subscribe(\n    productIds = listOf(\"BTC-USD\"),\n    channels = listOf(\"ticker\")\n)\n\ngdaxService.observeWebSocketEvent()\n    .filter { it is WebSocket.Event.OnConnectionOpened\u003C*> }\n    .subscribe({\n        gdaxService.sendSubscribe(BITCOIN_TICKER_SUBSCRIBE_MESSAGE)\n    })\n\ngdaxService.observeTicker()\n    .subscribe({ ticker ->\n        Log.d(\"Bitcoin price is ${ticker.price} at ${ticker.time}\")\n    })\n~~~\n\n###  Android\nScarlet is driven by a [StateMachine][state-machine].\n\n\u003Cimg width=\"600 px\" src=\"\u002Fexample\u002Fscarlet-state-machine.png\"\u002F>\n\nTODO\n\n\nDownload\n--------\nScarlet is available via Maven Central.\n\nSnapshots of the development version are available in [Sonatype's `snapshots` repository][snap].\n\n##### Maven:\n```xml\n\u003Cdependency>\n    \u003CgroupId>com.tinder.scarlet\u003C\u002FgroupId>\n    \u003CartifactId>scarlet\u003C\u002FartifactId>\n    \u003Cversion>0.1.12\u003C\u002Fversion>\n\u003C\u002Fdependency>\n```\n\n##### Gradle:\n```groovy\nimplementation 'com.tinder.scarlet:scarlet:0.1.12'\n```\n\n### Plug-in Roadmap\n`WebSocket.Factory`\n- [x] `OkHttpClient`\n- [x] `MockHttpServer`\n\n`MessageAdapter.Factory`\n- [x] `moshi`\n- [x] `gson`\n- [x] `protobuf`\n- [x] `jackson`\n- [ ] `simple-xml`\n\n`StreamAdapter.Factory`\n- [x] `RxJava2`\n- [x] `RxJava1`\n- [x] `Kotlin Coroutine`\n\n`Lifecycle`\n- [x] `AndroidLifecycle`\n\n`BackoffStrategy`\n- [x] `Linear`\n- [x] `Exponential`\n- [x] `ExponentialWithJitter`\n\nCopyright\n---\n~~~\nCopyright (c) 2018, Match Group, LLC\nAll rights reserved.\n\nRedistribution and use in source and binary forms, with or without\nmodification, are permitted provided that the following conditions are met:\n    * Redistributions of source code must retain the above copyright\n      notice, this list of conditions and the following disclaimer.\n    * Redistributions in binary form must reproduce the above copyright\n      notice, this list of conditions and the following disclaimer in the\n      documentation and\u002For other materials provided with the distribution.\n    * Neither the name of Match Group, LLC nor the names of its contributors\n      may be used to endorse or promote products derived from this software\n      without specific prior written permission.\n\nTHIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\" AND\nANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED\nWARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE\nDISCLAIMED. IN NO EVENT SHALL MATCH GROUP, LLC BE LIABLE FOR ANY\nDIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES\n(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;\nLOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND\nON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS\nSOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n~~~\n\n [gdax-websocket-feed]: https:\u002F\u002Fdocs.gdax.com\u002F#websocket-feed\n [demo-app]: \u002Fdemo\u002Fsrc\u002Fmain\u002Fjava\u002Fcom\u002Ftinder\u002Fapp\n [tutorial]: https:\u002F\u002Fmedium.com\u002Ftinder-engineering\u002Ftaming-websocket-with-scarlet-f01125427677\n [slides]: https:\u002F\u002Fspeakerdeck.com\u002Fzhxnlai\u002Ftaming-websocket-with-scarlet\n [kotliners]: https:\u002F\u002Fwww.conferenceforkotliners.com\u002F\n [state-machine]: https:\u002F\u002Fgithub.com\u002FTinder\u002FStateMachine\n [snap]: https:\u002F\u002Foss.sonatype.org\u002Fcontent\u002Frepositories\u002Fsnapshots\u002Fcom\u002Ftinder\u002Fscarlet\u002F\n","Scarlet是一个受Retrofit启发的WebSocket客户端，专为Kotlin、Java和Android设计。它通过声明式接口定义WebSocket通信，并支持多种消息适配器（如Moshi, Gson, Protobuf等）与流适配器（如RxJava2, Kotlin协程），使得数据处理更加灵活高效。此外，Scarlet内置了状态机机制来管理WebSocket连接的生命週期，还提供了线性、指数等多种重试策略以增强连接稳定性。此项目非常适合需要在移动应用或后端服务中实现实时通讯功能的场景，例如在线聊天、股票行情更新等。",2,"2026-06-11 03:12:02","top_language"]