[erlang-questions] listen to http and non-http tcp connections in cowboy

Loïc Hoguin essen@REDACTED
Sat May 12 02:11:08 CEST 2012


The way I usually suggest this is to start a listener for your 
flash_policy_server protocol that would detect what protocol is used 
from the first few bytes and redirect to cowboy_http_protocol if it's 
HTTP (calling init, not start_link).

You'll probably need to patch cowboy_http_protocol a little (I'm 
interested in such a patch) or use inet_tcp:unrecv/2 to put the data you 
read back into the socket buffer so that cowboy_http_protocol can run 
directly.

On 05/11/2012 10:22 PM, AD wrote:
> hello,
>
>   We are looking to implement a flash policy server on our cowboy
> websocket server.  Using websocket-js, the flash swf on the client will
> communicate over raw TCP socket to get a policy file back.  Is there a
> way to have a cowboy server set up to serve HTTP requests, but to also
> be able to deal with non-http in the same instance and same port?
>
> Thanks
> -AD
>
>
> _______________________________________________
> erlang-questions mailing list
> erlang-questions@REDACTED
> http://erlang.org/mailman/listinfo/erlang-questions


-- 
Loïc Hoguin
Erlang Cowboy
Nine Nines



More information about the erlang-questions mailing list