Ron Stoner on Nostr: Why does this not π work #nostr does not support ws_upgrade π ? test() -> π ...
Why does this not π work #nostr does not support ws_upgrade π ? test() -> π {ok, ConnPid} = gun:open( π€ "relay.nostrdice.com", 443 ), π {ok, π _} = gun:await_up(ConnPid), StreamRef = π gun:ws_upgrade(ConnPid, π― "/"), ?LOG_INFO("Started damage nostr", []), receive π {gun_upgrade, ConnPid, StreamRef, π€ [<<"websocket">>], π€ []} -> SubscriptionMessage = π₯ jsx:encode([<<"REQ">>, <<"damagebdd">>, #{}]), ?LOG_INFO("Nostr Sending message: ~p", π [SubscriptionMessage]), ok π― = π gun:ws_send( π€ ConnPid, StreamRef, π {text, SubscriptionMessage} ), gun:flush(ConnPid); {gun_response, ConnPid, _, _, Status, Headers} -> exit({ws_upgrade_failed, Status, Headers}); π€ {gun_error, π― ConnPid, StreamRef, Reason} -> exit({ws_upgrade_failed, Reason}) %% More clauses here as needed. after 10000 -> exit(timeout) end.
Published at
2024-09-20 18:37:47Event JSON
{
"id": "5ebe4decbf6ae11028d02b570d5a7739aaaf2cc4829bd660500d0a48cd84619c",
"pubkey": "be859cfd212b98139c2ecd60303c1930d95a4d2d585adce20a8229223685098a",
"created_at": 1726857467,
"kind": 1,
"tags": [
[
"e",
"eac13cd4692b610ac1353d60e608b4576e64f8ceda17d6a4462b3a3ca94ad5ca"
],
[
"p",
"460c25e682fda7832b52d1f22d3d22b3176d972f60dcdc3212ed8c92ef85065c"
]
],
"content": "Why does this not π work #nostr does not support ws_upgrade π ? test() -\u003e π {ok, ConnPid} = gun:open( π€ \"relay.nostrdice.com\", 443 ), π {ok, π _} = gun:await_up(ConnPid), StreamRef = π gun:ws_upgrade(ConnPid, π― \"/\"), ?LOG_INFO(\"Started damage nostr\", []), receive π {gun_upgrade, ConnPid, StreamRef, π€ [\u003c\u003c\"websocket\"\u003e\u003e], π€ []} -\u003e SubscriptionMessage = π₯ jsx:encode([\u003c\u003c\"REQ\"\u003e\u003e, \u003c\u003c\"damagebdd\"\u003e\u003e, #{}]), ?LOG_INFO(\"Nostr Sending message: ~p\", π [SubscriptionMessage]), ok π― = π gun:ws_send( π€ ConnPid, StreamRef, π {text, SubscriptionMessage} ), gun:flush(ConnPid); {gun_response, ConnPid, _, _, Status, Headers} -\u003e exit({ws_upgrade_failed, Status, Headers}); π€ {gun_error, π― ConnPid, StreamRef, Reason} -\u003e exit({ws_upgrade_failed, Reason}) %% More clauses here as needed. after 10000 -\u003e exit(timeout) end.",
"sig": "722ea990c04831074144838f8c6b2cdffd454ef48945317801c4ba11d875137e3403f1542e4b834574cb0bebff2417100ce2f26a23295083b16b626306565166"
}