{"id":21322043,"url":"https://github.com/advantageous/ddp-client-java","last_synced_at":"2025-07-12T05:30:44.441Z","repository":{"id":13466725,"uuid":"16156598","full_name":"advantageous/ddp-client-java","owner":"advantageous","description":"Meteor DDP Client for Java","archived":false,"fork":false,"pushed_at":"2015-01-12T21:55:30.000Z","size":553,"stargazers_count":18,"open_issues_count":2,"forks_count":2,"subscribers_count":8,"default_branch":"master","last_synced_at":"2025-04-06T14:21:30.366Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/advantageous.png","metadata":{"files":{"readme":"README.md","changelog":null,"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":"2014-01-22T23:48:17.000Z","updated_at":"2019-10-27T17:26:25.000Z","dependencies_parsed_at":"2022-09-26T19:31:39.881Z","dependency_job_id":null,"html_url":"https://github.com/advantageous/ddp-client-java","commit_stats":null,"previous_names":["sailorgeoffrey/ddp-client-java"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/advantageous/ddp-client-java","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/advantageous%2Fddp-client-java","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/advantageous%2Fddp-client-java/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/advantageous%2Fddp-client-java/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/advantageous%2Fddp-client-java/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/advantageous","download_url":"https://codeload.github.com/advantageous/ddp-client-java/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/advantageous%2Fddp-client-java/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":264941541,"owners_count":23686509,"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":[],"created_at":"2024-11-21T20:12:54.741Z","updated_at":"2025-07-12T05:30:44.195Z","avatar_url":"https://github.com/advantageous.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"#Meteor DDP Client for Java  [![Build Status](https://travis-ci.org/advantageous/ddp-client-java.png?branch=master)](https://travis-ci.org/advantageous/ddp-client-java)\n\n**\"Meteor is an open-source platform for building top-quality web apps in a fraction of the time, whether you're an expert developer or just getting started.\"  [-Meteor Website](https://www.meteor.com/)**\n\nThis library allows Java developers to make clients for Meteor web applications that can take advantage of [data subscriptions](http://docs.meteor.com/#publishandsubscribe) and published [RPC methods](http://docs.meteor.com/#methods_header).\n\n##Quick Start\n\n**Note: This project requires JDK 1.8 and Gradle.**\nA backport to JDK 1.7 can be found in [this branch](https://github.com/advantageous/ddp-client-java/tree/jdk7)\n\n* Checkout this repo\n* Run the meteor app locally\n```\ncd examples/meteor-common\nmeteor\n```\n* Build and run a sample application\n```\ngradle jar\njava -jar examples/simple-subscription/build/libs/simple-subscription.jar\n```\n\n* Open a web browser and go to http://localhost:3000\n* Enjoy!\n\n##Maven/Gradle Dependency\nRelease versions of this library are published to the Maven Central Repository.\nIf you are using Maven, add the dependency to your pom.xml\n```xml\n    \u003cdependency\u003e\n        \u003cgroupId\u003eio.advantageous.ddp\u003c/groupId\u003e\n        \u003cartifactId\u003eddp-client\u003c/artifactId\u003e\n        \u003cversion\u003e1.0.0\u003c/version\u003e\n    \u003c/dependency\u003e\n```\nIf you are using Gradle\n```groovy\n    compile 'io.advantageous.ddp:ddp-client:1.0.0'\n```\n\n##Components\n\nThis library can be described by breaking it into three main parts.\n\n * Common Message Components\n * Subscription Adapters\n * RPC Client\n\nThe package structure represents this grouping as well.\n\n###DDPMessageEndpoint\nThe message endpont is the websocket endpoint for all the DDP messages.  The endpoint is responsible for handling the\nconnection to the Meteor server and dispatching DDP messages to listeners.  Listeners are registered with the\nregisterHandler method.\n\nThe constructor takes two arguments: a javax.websocket.WebsocketContainer, and a MessageConverter.\n\n```java\n    DDPMessageEndpoint endpoint = new DDPMessageEndpointImpl(webSocketContainer, messageConverter);\n\n    endpoint.registerHandler(ConnectedMessage.class, message -\u003e\n            System.out.println(\"connected to server! session: \" + message.getSession()));\n```\n\n###MessageConverter\nThe message converter is what converts a DDP message into a strongly typed Java message object.  The only included\nimplementation is a JSONMessageConverter because the Meteor server uses JSON over websocket by default.  The reason this\nwas abstracted out of the main client is because one could potentially use another serialization strategy here.\n(Google's Protocol Buffers, for example)\n\n###SubscriptionAdapter\nA subscription adapter is responsible for subscribing and unsubscribing from collections and handling subscription\nmessages.  This library includes a MapSubscription adapter that updates a java.util.Map from subscription messages.  The\nmap is injected into the MapSubscriptionAdapter so that you can use a simple HashMap or any map provider. (Memcached,\nJGroups, etc.)\n\nYou can also extend the BaseSubscriptionAdapter to use any other local storage.  (minimongo anyone?)\n\n```java\n    Map\u003cString, Map\u003cString, Object\u003e\u003e dataMap = new HashMap\u003c\u003e();\n\n    SubscriptionAdapter adapter = new MapSubscriptionAdapter(\n            endpoint,\n            new JsonObjectConverter(),\n            dataMap\n    );\n\n    // Subscribe to a collection when a connection is established\n    endpoint.registerHandler(ConnectedMessage.class, message -\u003e {\n        try {\n            adapter.subscribe(new Subscription(\"employees\", Employee.class));\n        } catch (IOException e) {\n            throw new IllegalStateException(e);\n        }\n    });\n\n```\n\n###ObjectConverter\nThe object convert is what converts Added and Changed DDP messages into their mapped Java objects.  The only included\nconverter is a JSON converter, but an EJSON converter would be handy in the future.\n\n###RPCClient\nThe RPC client is used to call Meteor.method functions.  The call method requires callbacks for success and failure.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fadvantageous%2Fddp-client-java","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fadvantageous%2Fddp-client-java","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fadvantageous%2Fddp-client-java/lists"}