Hello, I’ve just started using Jami and I was trying to setup push notifications on my android phone. In the app I have unifiedpush enabled and the DHT proxy but with these options enabled I don’t seem to receive any messages at all. My device won’t even load messages with the app open. Only when I switch to local DHT node do I start receiving messages and notifications.
Is there anything else you need to to get push notifications working?
OpenDHT isn’t compatible with UnifiedPush AND_3, it doesn’t implement Web Push.
So basically unified push doesn’t work in Jami even though the client displays it as an option?
Maybe some legacy UnifiedPush distributors work… If they follow the legacy UnifiedPush specifications…
@Jami Can you try the workaround from Specification compliance status ?
A temporary hack is to set content-encoding to aes128gcm and add TTL header, it should be seen as a valid web push message. If the message doesn’t contain any sensitive information, that 's OK.
I don’t know much about Jami/OpenDHT, but from a quick glance it looks like the headers for a unified push request can be modified here
unsigned reqid = 0;
try {
std::shared_ptr<http::Request> request;
http::Url tokenUrl(token);
if (type == PushType::UnifiedPush)
request = std::make_shared<http::Request>(io_context(), tokenUrl.protocol + "://" + tokenUrl.host + (tokenUrl.service.empty() ? "" : (":" + tokenUrl.service)), logger_);
else
request = std::make_shared<http::Request>(io_context(), pushHostPort_.first, pushHostPort_.second, pushHostPort_.first.find("https://") == 0, logger_);;
reqid = request->id();
request->set_target(type == PushType::UnifiedPush ? (tokenUrl.target) : "/api/push");
request->set_method(restinio::http_method_post());
request->set_header_field(restinio::http_field_t::host, type == PushType::UnifiedPush ? tokenUrl.host.c_str() : pushServer_.c_str());
request->set_header_field(restinio::http_field_t::user_agent, "RESTinio client");
request->set_header_field(restinio::http_field_t::accept, "*/*");
request->set_header_field(restinio::http_field_t::content_type, "application/json");
if (type == PushType::UnifiedPush) {
Json::Value notification(Json::objectValue);
notification["message"] = Json::writeString(jsonBuilder_, std::move(json));
notification["topic"] = token;
If jami doesn’t respond I think I may look at running my own proxy with the workaround suggested above.
So I decided to test this out myself and the workaround seems to work! I have a self hosted OpenDHT proxy running with the changes in this PR and I am able to get push notifications on my device when I connect to my self hosted proxy.
master ← Hazematman:fix_unified_push
opened 11:40PM - 12 Nov 25 UTC
UnifiedPush AND_3 spec requires that server-to-server communication use encrypte… d WebPush requests. Currently the OpenDHT proxy does not do that. Following the advice in this issue https://codeberg.org/UnifiedPush/wishlist/issues/22 this PR worksaround the issue by making the request look like a real encrypted WebPush request following the example the FindMyDevice server is using https://gitlab.com/fmd-foss/fmd-server/-/merge_requests/101
This should be okay as the actual message contents are e2ee (to my knowledge) so if we just mark the payload as encrypted we can make unifiedpush servers happy.
1 Like
Excuse me, is it possible to set a timer through a serverless fake distributor to wake up a client operating in local DHT node mode?
It is not a good idea, because you have to choose a very high frequency to handle connection requests otherwise Jami will not receive any message.
It’s merged, but dhtproxy2.jami.net didn’t send content_encoding header.
I don’t know for sure but I suspect the official proxies aren’t running the update yet. The latest v3.6.0 release doesn’t include the fix Release v3.6.0 · savoirfairelinux/opendht · GitHub