Question

I am implementing cowboy websocket. Everything is working fine except when user closes the browser it fires websocket_termination and at server end it generates following error:-

Error in process <0.298.0> on node 'ews_2@servername.com' with exit value: {function_clause,   
[{cowboy_req,ensure_response,[{[]},204],[{file,"src/cowboy_req.erl"},{line,1112}]},     
{cowboy_protocol,next_request,3,[{file,"src/cowboy_protocol.erl"},{line,545}]}]}

Code in websocket_termination is :-

websocket_terminate(Reason, Req, State) ->
io:format("~nWebsocket connection termination~n"),
ok.
Was it helpful?

Solution

Resolved: Problem was Req was not getting passed and got manipulated between the callbacks... Cowboy needs a proper Req parameter to be passed at the time of connection termination.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top