Hi everyone
Just updated phoenix.js
to latest where the .onError
signature seems to have changed
Previously, I was just getting the status code as a string. Now I’m getting an object with shape
{
isTrusted: false,
message: "Expected HTTP 101 response but was '[Status Code] [Status Code Label]'"
}
Not sure exactly what happened.
That being said, I also discovered since I last updated my deps that Socket.connect/2
return value also got updated, now allowing you to return {:error, term}
instead of just :error
I tried doing just that, as well as implementing the Endpoint websocket error_handler
as instructed here, however, I get the same error object as above (and yes I restarted the server)
conn |> Plug.Conn.send_resp(401, "this string never makes it RIP")
returns err
on the js client socket instance socket.onError(err =>
{
"isTrusted": false,
"message": "Expected HTTP 101 response but was '401 Unauthorized'"
}
The only part that changes in the response is the string following ... response but was
Any ideas?
NB: Currently circumventing with
err.message.toString().includes(statusCode)