Diff

plugins/mod_websocket.lua @ 7340:7dea28dafc49

mod_websocket: Fix read timeout handler (thanks mt)
author Kim Alvefur <zash@zash.se>
date Wed, 06 Apr 2016 14:44:51 +0200
parent 7315:4fd984d1e445
child 7716:779a9ef6b4fd
line wrap: on
line diff
--- a/plugins/mod_websocket.lua	Wed Dec 18 18:11:47 2013 -0500
+++ b/plugins/mod_websocket.lua	Wed Apr 06 14:44:51 2016 +0200
@@ -291,7 +291,10 @@
 end
 
 local function keepalive(event)
-	return conn:write(build_frame({ opcode = 0x9, }));
+	local session = event.session;
+	if session.open_stream == session_open_stream then
+		return session.conn:write(build_frame({ opcode = 0x9, }));
+	end
 end
 
 module:hook("c2s-read-timeout", keepalive, -0.9);