|
@@ -92,14 +92,15 @@ init([Env, WsPid, Req, ReplyChannel]) ->
|
|
|
{ok, Peername} = Req:get(peername),
|
|
{ok, Peername} = Req:get(peername),
|
|
|
Headers = mochiweb_headers:to_list(
|
|
Headers = mochiweb_headers:to_list(
|
|
|
mochiweb_request:get(headers, Req)),
|
|
mochiweb_request:get(headers, Req)),
|
|
|
|
|
+ Conn = Req:get(connection),
|
|
|
ProtoState = emqttd_protocol:init(Peername, send_fun(ReplyChannel),
|
|
ProtoState = emqttd_protocol:init(Peername, send_fun(ReplyChannel),
|
|
|
[{ws_initial_headers, Headers} | Env]),
|
|
[{ws_initial_headers, Headers} | Env]),
|
|
|
IdleTimeout = get_value(client_idle_timeout, Env, 30000),
|
|
IdleTimeout = get_value(client_idle_timeout, Env, 30000),
|
|
|
EnableStats = get_value(client_enable_stats, Env, false),
|
|
EnableStats = get_value(client_enable_stats, Env, false),
|
|
|
ForceGcCount = emqttd_gc:conn_max_gc_count(),
|
|
ForceGcCount = emqttd_gc:conn_max_gc_count(),
|
|
|
- {ok, #wsclient_state{ws_pid = WsPid,
|
|
|
|
|
|
|
+ {ok, #wsclient_state{connection = Conn,
|
|
|
|
|
+ ws_pid = WsPid,
|
|
|
peername = Peername,
|
|
peername = Peername,
|
|
|
- connection = Req:get(connection),
|
|
|
|
|
proto_state = ProtoState,
|
|
proto_state = ProtoState,
|
|
|
enable_stats = EnableStats,
|
|
enable_stats = EnableStats,
|
|
|
force_gc_count = ForceGcCount},
|
|
force_gc_count = ForceGcCount},
|