I need detect a client disconnection in the server side, for client call POST resquest and try to RollBack Apply.
In this moment my PHOENIX RestFul Server api don’t detect the client disconnection .
The happy path flow for POST call:
Request
1 .- Client -------------------> Server EndPoint
2.- tasks
Response
3.- Client <--------------------render(conn, “payload.json”, result)
My flow problem :
Request
1 .- Client ------------------> Server EndPoint
2.- tasks
3.- Client Disconnection .
Response
-----/////------------- render(conn, “payload.json”, result)
(“My app don’t detect client disconnection”)
How to detect the client’s disconnection’s ???
Context:
I made a Service RestFul in the way :
https://medium.com/@pamit/building-a-restful-backend-with-elixir-phoenix-84fe390975c
Router:
use BusiApiWeb, :router
pipeline :api do
plug :accepts, ["json"]
end
pipeline :auth do
plug BusiApiWeb.Auth.Pipeline
end
scope "/api", BusiApiWeb do
pipe_through :api
post "/users/signup", UserController, :create
post "/users/signin", UserController, :signin
end
scope "/api", BusiApiWeb do
pipe_through [:api, :auth]
post "/payload",PayloadController, :payload
end
Controller:
....
use BusiApiWeb, :controller
def payload(conn, _params) do
render(conn, "payload.json")
end
View :
....
use BusiApiWeb, :view
def render("payload.json") do
%{ tag: "ok" }
end