How to make synchronous websocket call without passing ref to websocket server

Hi all ,

Does anyone know how to make synchronous websocket call without passing ref to websocket server ?

Let say server A is our elixir app and server B is websocket server , I’ve found some solutions like :

  1. https://www.annkissam.com/elixir/alembic/posts/2018/07/30/genserver-reply.html
  2. https://github.com/mobileoverlord/phoenix_client/blob/master/lib/phoenix_client/socket.ex

but those solutions must passing the ‘ref’ data to the websocket server and return it back to our elixir app,
is there any other solution ?

I’m using websockex btw

thx

Am I use it wrong ?

WebSocket doesn’t have synchronous requests.

The Phoenix Channel JavaScript client sends an event with a ref and then listens for the response from the server with that ref. When it sees it, it involves your callback from the client.