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.

Reply to this note

Please Login to reply.