Closed shtanaka closed 6 years ago
I guess you'd have to create the socket instance yourself (const socket = new Socket()
from the phoenix-js library) and then give that socket to APW using the socket:
option, that way you can attach your own error handlers to the socket.
I couldn't make it work using socket:
option. I used Socket:
instead and passed the function. It worked as following:
const networkInterface = createNetworkInterface({
uri: WS_URI,
Socket: (uri, options) => {
const socket = new Socket(uri, options);
socket.onOpen(() => {
// handle open
});
socket.onError(() => {
// handle error
});
return socket;
}
})
Thanks for the help 👍
I am looking for a away to handle errors when the server loses the connection. I tried to use the
applyAfterware
, however it does not catch it since there is no response from the server. I always get the following error message in console:failed: Error during WebSocket handshake: net::ERR_INVALID_HTTP_RESPONSE
What is the best way to catch that kind of error using apollo-phoenix-websocket?