elixir-plug / plug_cowboy

Plug adapter for the Cowboy web server

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

`protocol_options` `:idle_timeout` not getting applied

nichita-pasecinic opened this issue · comments

Hi 👋,

children = [
      Plug.Cowboy.child_spec(
        scheme: :http,
        plug: WSServer.Router,
        options: [
          dispatch: dispatch(),
          port: port(),
          transport_options: [
            num_acceptors: 2,
            max_connections: 16_384 # => default
          ],
          protocol_options: [
            idle_timeout: 1000 # => not getting applied
          ]
        ]
      )
    ]

But is getting applied inside SocketHandler init callback

def init(req, state) do
    Logger.info("[SocketHandler] init")
    dbg({req, state})
    state = %{registry_key: req.path}

    {:cowboy_websocket, req, state, %{idle_timeout: :infinity}}
end

Is there anything I'm missing ?

How are you measuring it? The idle timeout on the config is for http, not websockets.