Pubsub stream to cowboy connection not working

i’ll try to describe my next steps:

In the server side I need to use cowboy’s websocket api
@behaviour :cowboy_websocket_handler
in the init i’ll start the PubSub and spawn a process that will stream_from_file

def init({tcp, http}, _req, _opts) do
    {:ok, _pid} = PubSub.start_link()
    spawn fn ->
        stream_from_file("./song.mp3", 128)
    end
    {:upgrade, :protocol, :cowboy_websocket}
 end

in the websocket_init idk what i need to do

def websocket_init(_TransportName, req, _opts)
    {:ok, req, :undefined_state }
  end

and in websocket_handle i’ll handle the “Play” button, on click in the client side i’ll need to subscribe the the topic :radio

def websocket_handle({:text, content}, req, state) do
  :ok = PubSub.subscribe(spawn(fn -> send_chunk_to_connection(conn) end), :radio)
  {:reply, {:text, reply}, req, state}
end

and my problem is in the client side (javacsript) how to decode the data so it will be played in the audio tag

websocket.onmessage = function(evt) { /* decode audio */ };