[99s-extend] Cowboy Middleware and websockets

Eduardo Gurgel edgurgel at gmail.com
Mon May 20 16:06:20 CEST 2013


On Mon, May 20, 2013 at 10:25 AM, Loïc Hoguin <essen at ninenines.eu> wrote:

> On 05/20/2013 01:53 PM, Eduardo Gurgel wrote:
>
>>
>>
>>
>> On Sun, May 19, 2013 at 10:01 PM, Eduardo Gurgel <edgurgel at gmail.com
>> <mailto:edgurgel at gmail.com>> wrote:
>>
>>     I want to write a cowboy middleware that works only on non-websocket
>>     requests. How can I achieve this? Is there any way that I ask the
>>     Request if this is a websocket request?
>>
>>
>> Thinking about my question, I see that the middleware (if it's behind
>> the cowboy_handler) can't figure if the connection will be upgraded or
>> not.
>>
>> Still, it would be cool if I could select which routes will be applied
>> to my middleware.
>>
>
> You have the Req which can help you do things based on host or path, and
> you also have the environment, which contains the name of the handler
> that's gonna be used if you execute your middleware after cowboy_router.
>
>
Perfect! The environment can help me :)


Thank you, again!

-- 
Eduardo
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.ninenines.eu/archives/extend/attachments/20130520/5134ba32/attachment.html>


More information about the Extend mailing list