[99s-extend] websocket handler

Loïc Hoguin essen at ninenines.eu
Mon Mar 30 17:18:02 CEST 2015


[<Opts>] is "Opts" in init/3. Whatever value you put there you receive 
in your handler.

On 03/30/2015 05:12 PM, Samir Sow wrote:
> Hi,
>
> I would like to pass data to my websocket handler (Opts params).
>
> init({tcp, http}, Req, Opts) ->
> 	{upgrade, protocol, cowboy_websocket, Req, Opts}.
>
> websocket_init(_TransportName, Req, Opts) ->
>
> I guess the Opts param is read from the routing data.
> What’s the right syntax to do that.
>
> Dispatch = cowboy_router:compile([
> 		{'_', [
> 			{'_', <my_handler>, [<Opts>]}
> 		]}
> 	]),
>
> Thank you.
>
> Sincerely.
>
> Samir Sow
> _______________________________________________
> Extend mailing list
> Extend at lists.ninenines.eu
> https://lists.ninenines.eu/listinfo/extend
>

-- 
Loïc Hoguin
http://ninenines.eu


More information about the Extend mailing list