{"id":17348449,"url":"https://github.com/daniel-sc/rocketchat-modern-client","last_synced_at":"2025-04-14T20:56:55.439Z","repository":{"id":25302159,"uuid":"103627445","full_name":"daniel-sc/rocketchat-modern-client","owner":"daniel-sc","description":"Client SDK for https://rocket.chat employing reactive style.","archived":false,"fork":false,"pushed_at":"2025-03-10T15:52:38.000Z","size":200,"stargazers_count":11,"open_issues_count":2,"forks_count":11,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-04-06T19:44:44.230Z","etag":null,"topics":["reactive","rocketchat","rocketchat-modern-client"],"latest_commit_sha":null,"homepage":"","language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/daniel-sc.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-09-15T07:24:55.000Z","updated_at":"2025-03-10T15:52:42.000Z","dependencies_parsed_at":"2022-07-24T21:17:20.096Z","dependency_job_id":null,"html_url":"https://github.com/daniel-sc/rocketchat-modern-client","commit_stats":null,"previous_names":[],"tags_count":16,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/daniel-sc%2Frocketchat-modern-client","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/daniel-sc%2Frocketchat-modern-client/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/daniel-sc%2Frocketchat-modern-client/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/daniel-sc%2Frocketchat-modern-client/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/daniel-sc","download_url":"https://codeload.github.com/daniel-sc/rocketchat-modern-client/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248961186,"owners_count":21189991,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["reactive","rocketchat","rocketchat-modern-client"],"created_at":"2024-10-15T16:52:27.173Z","updated_at":"2025-04-14T20:56:55.423Z","avatar_url":"https://github.com/daniel-sc.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"[![No Maintenance Intended](http://unmaintained.tech/badge.svg)](http://unmaintained.tech/)\n\n# Deprecated / Unmaintained\nThis project does not work with version 7.x of Rocket Chat (https://github.com/daniel-sc/rocketchat-modern-client/issues/32).\n\nThe author of this package has no time to maintain this package - so if you are interested, please fork or provide PRs :)\n\n\n# Rocketchat modern client\n\n![CI](https://github.com/daniel-sc/rocketchat-modern-client/actions/workflows/build-and-test.yaml/badge.svg)\n[![Coverage Status](https://coveralls.io/repos/github/daniel-sc/rocketchat-modern-client/badge.svg?branch=master)](https://coveralls.io/github/daniel-sc/rocketchat-modern-client?branch=master)\n[![Maven Central](https://img.shields.io/maven-central/v/com.github.daniel-sc/rocketchat-modern-client?color=green)](https://mvnrepository.com/artifact/com.github.daniel-sc/rocketchat-modern-client)\n\nThis project aims to provide a simple java client for the [Rocket.Chat](https://rocket.chat) live chat api.\nThe current focus is on ease of usability and solid core functionality over complete method coverage (PRs always welcome!).\n\n## Read first\nMake sure you have at least some rough understanding of [CompletableFuture](https://docs.oracle.com/javase/8/docs/api/java/util/concurrent/CompletableFuture.html)\nand [RxJava](https://github.com/ReactiveX/RxJava) as these are used heavily for the client api.\n\n## Setup\nJust include the client as Maven dependency in your `pom.xml` via:\n\n```xml\n\u003cdependency\u003e\n    \u003cgroupId\u003ecom.github.daniel-sc\u003c/groupId\u003e\n    \u003cartifactId\u003erocketchat-modern-client\u003c/artifactId\u003e\n    \u003cversion\u003e1.3.1\u003c/version\u003e\n\u003c/dependency\u003e\n```\n\n## Usage\n\nGet subscriptions/rooms:\n```java\ntry(RocketChatClient client = new RocketChatClient(\"wss://open.rocket.chat:443/websocket\", new LoginParam(USERNAME, PASSWORD))) {\n    List\u003cSubscription\u003e subscriptions = client.getSubscriptions().join();\n}\n```\n\nSend message:\n```java\ntry(RocketChatClient client = new RocketChatClient(URL, new LoginParam(USERNAME, PASSWORD))) {\n    ChatMessage msg = client.sendMessage(\"Your message\", roomId).join();\n}\n```\n\nSend message with alias and avatar:\n```java\ntry(RocketChatClient client = new RocketChatClient(URL, new LoginParam(USERNAME, PASSWORD))) {\n    ChatMessage msg = client.sendMessageExtendedParams(\"Your message\", roomId, \"Alias\", \"https://goo.gl/8afu6d\", null, null, null).join();\n}\n```\n\n\nSend message with alias and emoji:\n```java\ntry(RocketChatClient client = new RocketChatClient(URL, new LoginParam(USERNAME, PASSWORD))) {\n    ChatMessage msg = client.sendMessageExtendedParams(\"Your message\", roomId, \"Alias\", null, \":e-mail:\", null, null).join();\n}\n```\n\n_If you send both avatar and emoji, rocket chat client show only avatar._\n```\nChatMessage msg = client.sendMessageExtendedParams(\"Your message\", roomId, \"Alias\", \"https://goo.gl/8afu6d\", \":e-mail:\", null, null).join();\n```\n\nUpdate message:\n```java\ntry(RocketChatClient client = new RocketChatClient(URL, new LoginParam(USERNAME, PASSWORD))) {\n    ChatMessage chatMessage = client.sendMessage(\"Your message\", roomId).join();\n    String edited = \"~\" + chatMessage.msg + \"~\"; // strikethrough original message\n    new Scanner(System.in).nextLine(); // Wait ...\n    ChatMessage editedMessage = client.updateMessage(edited, chatMessage._id).join();\n}\n```\n\nStream/read messages:\n```java\ntry(RocketChatClient client = new RocketChatClient(URL, new LoginParam(USERNAME, PASSWORD))) {\n    Observable\u003cChatMessage\u003e msgStream = client.streamRoomMessages(roomId).join();\n    msgStream.forEach(msg -\u003e System.out.println(\"received msg: \" + msg));\n    // block thread until you got enough messages.. (or don't use try-with and close client explicitly)\n    msgStream.dispose();\n}\n```\n\nSend message with _Attachments_ and _Attachment Fields_:\n```java\ntry(RocketChatClient client = new RocketChatClient(URL, new LoginParam(USERNAME, PASSWORD))) {\n    List\u003cAttachment\u003e attachments = new ArrayList\u003cAttachment\u003e();\n\n    Attachment a1 = new Attachment();        \n    a1.color = \"#0000ff\";\n    a1.iso8601Date = \"2001-02-03T04:05:06.789Z\";\n    a1.text = \"Test attachment message\\nand next **line** ~~with~~ **mark-down** formatting\\n:-) ...\";\n    a1.authorName = \"author\";\n    a1.authorIcon = \"https://avatars2.githubusercontent.com/u/0?s=400\u0026v=4\";\n    a1.authorLink = \"https://github.com/\";\n    a1.title = \"Attachment test A1\";\n    a1.titleLink = \"https://www.google.com/?q=Attachment%20test%20A1\";\n    attachments.add(a1);\n\n    Attachment a2 = new Attachment();\n    a2.imageUrl = \"https://cdn3.iconfinder.com/data/icons/iconshock_developer/linux.png\";        \n    attachments.add(a2);\n            \n    Attachment a3 = new Attachment();\n    a3.color = \"#00FF00\";\n    a3.title = \"Project status\"; \n    List\u003cAttachmentField\u003e attachmentFields = new ArrayList\u003c\u003e();\n    attachmentFields.add(new AttachmentField(true, \"Status\", \"New\"));\n    attachmentFields.add(new AttachmentField(true, \"Priority\", \"High\"));    \n    attachmentFields.add(new AttachmentField(true, \"Tags\", \"Test, Chat\"));\n    a3.fields = attachmentFields;\n    attachments.add(a3);\n    ChatMessage msg = client.sendMessageExtendedParams(message, roomId, rcAlias, rcAvatar, rcEmoji, null, attachments).join();\n}\n```\n![Message with Attachments and Attachment Fields](img/message_attachments.png)\n\n## Websocket API\nThis client ships with [Tyrus](https://github.com/tyrus-project/tyrus)\nwebsocket reference implementation.\n\nIf you like, you can replace the websocket library with any \nother JSR-356 compliant implementation of [WebSocket Server API](https://mvnrepository.com/artifact/javax.websocket/javax.websocket-api).\nJust update your `pom.xml` as follows:\n```xml\n\u003cdependency\u003e\n    \u003cgroupId\u003ecom.github.daniel-sc\u003c/groupId\u003e\n    \u003cartifactId\u003erocketchat-modern-client\u003c/artifactId\u003e\n    \u003cversion\u003e0.1.0\u003c/version\u003e\n    \u003cexclusions\u003e\n        \u003cexclusion\u003e\n            \u003cgroupId\u003eorg.glassfish.tyrus.bundles\u003c/groupId\u003e\n            \u003cartifactId\u003etyrus-standalone-client-jdk\u003c/artifactId\u003e\n        \u003c/exclusion\u003e\n    \u003c/exclusions\u003e\n\u003c/dependency\u003e\n\u003cdependency\u003e\n    \u003cgroupId\u003esome.websocket-api.impl\u003c/groupId\u003e\n    \u003cartifactId\u003esome.websocket-api.impl\u003c/artifactId\u003e\n    \u003cversion\u003eVERSION\u003c/version\u003e\n\u003c/dependency\u003e\n```\n\n## Run integration tests\n```bash\nmvn clean install -Pintegration-test\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdaniel-sc%2Frocketchat-modern-client","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdaniel-sc%2Frocketchat-modern-client","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdaniel-sc%2Frocketchat-modern-client/lists"}