I'm developing an erlang app which use both cowboy and sockjs and I wonder if is it possible to link with the cowboy process which handles the websocket connection?
Right now process with gen_server behaviour is associated with each websocet conenction. Such process stores Conn instance in init and when the client closes connection this process is terminated from websocket handler, and if the gen_server process is terminated the Conn:close is called from the terminate() of gen_server which do the cleanup. It works, but I don'l like this solution, because there are several cases when even with trap_exit enabled terminate function would not be called, so if linking is possible it would be better and simplier solution.