mollyim / mollysocket

MollySocket allows getting Signal notifications via UnifiedPush.
GNU Affero General Public License v3.0
106 stars 10 forks source link

Notifications not going through to nfty #20

Closed aodhan-domhnaill closed 9 months ago

aodhan-domhnaill commented 10 months ago

I have a self-hosted ntfy server on my internal network (192.168.x.x) dnsmasq'ed to debian.apmac.us. I had this same issue with ntfy.sh server. I registered mollysocket like below, and the app says the connection is fine.

$ mollysocket connection list
[....cargo/registry/src/index.crates.io-6f17d22bba15001f/mollysocket-1.2.0/src/cli/connection.rs:75] &connection = Connection {
    uuid: "....",
    device_id: 2,
    password: "....",
    endpoint: "http://debian.apmac.us:8040/9123id9e7dh?up=1",
    forbidden: false,
    last_registration: OptTime(
        None,
    ),
}

Notifications work fine when done with curl or similar to a test url. If I try to curl -d hello http://debian.apmac.us:8040/9123id9e7dh?up=1 doesn't work (note the url is fake here, but I correctly copied it when I tested it), but I imagine this is because it requires a notification from molly.

DEBUG logs from Molly show signal notifications coming through, but maybe they aren't able to forward on to ntfy. There aren't any errors anywhere.

[2023-12-23T21:22:02Z INFO  mollysocket::server::connections] Starting connection for .......
[2023-12-23T21:22:03Z DEBUG tungstenite::handshake::client] Client handshake done.
[2023-12-23T21:22:03Z INFO  mollysocket::ws::websocket_connection] WebSocket handshake has been successfully completed

....

[2023-12-23T21:27:35Z DEBUG mollysocket::ws::websocket_connection] New message
[2023-12-23T21:27:35Z DEBUG mollysocket::ws::signalwebsocket] New request
[2023-12-23T21:27:36Z DEBUG mollysocket::ws::websocket_connection] New message
[2023-12-23T21:27:36Z DEBUG mollysocket::ws::signalwebsocket] New request
[2023-12-23T21:27:40Z DEBUG mollysocket::ws::websocket_connection] New message
[2023-12-23T21:27:40Z DEBUG mollysocket::ws::signalwebsocket] New request
[2023-12-23T21:27:40Z DEBUG mollysocket::ws::signalwebsocket] Sending the notification.
[2023-12-23T21:27:40Z DEBUG reqwest::connect] starting new connection: http://debian.apmac.us:8040/
[2023-12-23T21:27:42Z DEBUG mollysocket::ws::websocket_connection] New message
[2023-12-23T21:27:42Z DEBUG mollysocket::ws::signalwebsocket] New request
[2023-12-23T21:28:03Z DEBUG mollysocket::ws::websocket_connection] Sending Keepalive
[2023-12-23T21:28:03Z DEBUG mollysocket::ws::websocket_connection] send_keepalive
[2023-12-23T21:28:03Z DEBUG mollysocket::ws::websocket_connection] New message
[2023-12-23T21:28:03Z DEBUG mollysocket::ws::signalwebsocket] New response
[2023-12-23T21:28:33Z DEBUG mollysocket::ws::websocket_connection] Sending Keepalive

I checked the ntfy server cache and there is nothing from mollysocket

aodhan-domhnaill commented 10 months ago

I just realized that I forgot to try deleting the connection in the ntfy app and recreating it.

The connection that Molly app created shows "im.molly.unified_push" (or something similar. I forgot exactly now). I imagine that it might require something specific from the app.

I recreated with the same URL ending and got a bunch of {"urgent": true} notifications in ntfy. Meaning I see JSON in the notification.

raptor170 commented 10 months ago

I have a self-hosted ntfy server on my internal network (192.168.x.x) dnsmasq'ed to debian.apmac.us. I had this same issue with ntfy.sh server. I registered mollysocket like below, and the app says the connection is fine.

$ mollysocket connection list
[....cargo/registry/src/index.crates.io-6f17d22bba15001f/mollysocket-1.2.0/src/cli/connection.rs:75] &connection = Connection {
    uuid: "....",
    device_id: 2,
    password: "....",
    endpoint: "http://debian.apmac.us:8040/9123id9e7dh?up=1",
    forbidden: false,
    last_registration: OptTime(
        None,
    ),
}

Notifications work fine when done with curl or similar to a test url. If I try to curl -d hello http://debian.apmac.us:8040/9123id9e7dh?up=1 doesn't work (note the url is fake here, but I correctly copied it when I tested it), but I imagine this is because it requires a notification from molly.

DEBUG logs from Molly show signal notifications coming through, but maybe they aren't able to forward on to ntfy. There aren't any errors anywhere.

[2023-12-23T21:22:02Z INFO  mollysocket::server::connections] Starting connection for .......
[2023-12-23T21:22:03Z DEBUG tungstenite::handshake::client] Client handshake done.
[2023-12-23T21:22:03Z INFO  mollysocket::ws::websocket_connection] WebSocket handshake has been successfully completed

....

[2023-12-23T21:27:35Z DEBUG mollysocket::ws::websocket_connection] New message
[2023-12-23T21:27:35Z DEBUG mollysocket::ws::signalwebsocket] New request
[2023-12-23T21:27:36Z DEBUG mollysocket::ws::websocket_connection] New message
[2023-12-23T21:27:36Z DEBUG mollysocket::ws::signalwebsocket] New request
[2023-12-23T21:27:40Z DEBUG mollysocket::ws::websocket_connection] New message
[2023-12-23T21:27:40Z DEBUG mollysocket::ws::signalwebsocket] New request
[2023-12-23T21:27:40Z DEBUG mollysocket::ws::signalwebsocket] Sending the notification.
[2023-12-23T21:27:40Z DEBUG reqwest::connect] starting new connection: http://debian.apmac.us:8040/
[2023-12-23T21:27:42Z DEBUG mollysocket::ws::websocket_connection] New message
[2023-12-23T21:27:42Z DEBUG mollysocket::ws::signalwebsocket] New request
[2023-12-23T21:28:03Z DEBUG mollysocket::ws::websocket_connection] Sending Keepalive
[2023-12-23T21:28:03Z DEBUG mollysocket::ws::websocket_connection] send_keepalive
[2023-12-23T21:28:03Z DEBUG mollysocket::ws::websocket_connection] New message
[2023-12-23T21:28:03Z DEBUG mollysocket::ws::signalwebsocket] New response
[2023-12-23T21:28:33Z DEBUG mollysocket::ws::websocket_connection] Sending Keepalive

I checked the ntfy server cache and there is nothing from mollysocket

The ntfy server needs to be reachable from outside of your network. If you want to use your hosted ntfy. Will need to purchase a domain name. Easiest I found and personally use is cloudflared tunnels, point your tunnel to your 192.x.x.x or DNS masked address, than change your endpoint to 'https://yourboughtdomainname/whateversubdomainname'

p1gp1g commented 10 months ago

The ntfy server (or any other push server) needs to be reachable by mollysocket and the phone. It can work in a setup where ntfy is not exposed on the Internet.

If you see {"urgent":true} : that means that mollysocket works correctly, you may have something wrong in your setup, not related to mollysocket.

Check https://github.com/UnifiedPush/android-example

p1gp1g commented 9 months ago

I'm closing this because it is not related to any bugs but a personal setup issue. If you need help setting up or running mollysocket, check out the README, tutorials, or hit up the community