This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2020-07-16
Channels
- # aws (17)
- # babashka (2)
- # beginners (131)
- # bristol-clojurians (1)
- # calva (16)
- # chlorine-clover (6)
- # cider (10)
- # clara (5)
- # cljsrn (82)
- # clojure (176)
- # clojure-dev (14)
- # clojure-europe (13)
- # clojure-italy (13)
- # clojure-nl (4)
- # clojure-spec (10)
- # clojure-sweden (32)
- # clojure-uk (32)
- # clojuredesign-podcast (2)
- # clojurescript (34)
- # community-development (2)
- # conjure (17)
- # cursive (4)
- # datomic (51)
- # emacs (6)
- # figwheel-main (26)
- # fulcro (16)
- # graalvm (11)
- # jobs (2)
- # jobs-discuss (30)
- # kaocha (4)
- # meander (23)
- # off-topic (34)
- # pathom (5)
- # re-frame (10)
- # reagent (3)
- # reitit (6)
- # releases (3)
- # sci (36)
- # shadow-cljs (27)
- # sql (9)
- # testing (6)
- # tools-deps (28)
- # vim (8)
Does anyone know why the following does not actually send a response to wscat
? I have tries all kinds of things for :Data which is supposed to be a blob
including (a json string, a json smile, a .getBytes of json string, a plain test string, and the object shown below)
(aws/invoke (aws/client {:api :apigatewaymanagementapi})
{:op :PostToConnection
:request {:Data {"action" "pong"}, :ConnectionId id}})
PostToConnection
:op :PostToConnection
:request
{:Data blob, :ConnectionId string}
:required
[:ConnectionId :Data]
:response
nil
Sends the provided data to the specified connection.
is aws/validate-requests
something I call on the client that acts like a validate-requests!
or do I get a different client back. I tried the version where I get a client back, but it said the api was not implemented so I am assuming I just need to call it and it will change the state of the client.
As far as blobs go, I can't figure out how to make a blob that wscat
will understand, I just tried
(aws/invoke gw
{:op :PostToConnection
:request {:Data (bytes (byte-array (map (comp byte int) (json/generate-string {:action :pong})))), :ConnectionId id}})
and
(aws/invoke gw
{:op :PostToConnection
:request {:Data (bytes (byte-array (map (comp byte int) "test"))), :ConnectionId id}})
create the client, def it, call validate-requests on it, then use the client and it should throw a spec error when you give it an invalid blob
I will test giving it something bad now to make sure it throws errors. Both those do not give an error on the amazon side
Okay so I get no errors from the following for some reason:
(aws/validate-requests gw true)
(aws/invoke gw
{:op :PostToConnection
:request {:VeryBad {"a" "bad"}}})
It doesn't throw, but rather returns problems from the invocation call. After clearing up errors I am left with
(aws/invoke gw
{:op :PostToConnection
:request {:Data (byte-array (map (comp byte int) (json/generate-string {:action :pong})))
:ConnectionId id}})
Which produces:
"#:cognitect.anomalies{:category :cognitect.anomalies/not-found, :message \": No address associated with hostname\"}"
This leads me to believe {:api :apigatewaymanagementapi}
does not detect which deployment I am running, dev
in this case. Not sure where I would input this information or how to check if it does detect those things.I was following https://docs.aws.amazon.com/apigateway/latest/developerguide/apigateway-how-to-call-websocket-api-connections.html when I decided to try and use apigatewaymanagementapi directly rather than create my own http posts.
@mail524 Did you look at what I posted in the #datomic channel? https://clojurians.slack.com/archives/C03RZMDSH/p1594910648214000