Changeset

691:04662cc35280

mod_websocket: Answer ping frames
author Florian Zeitz <florob@babelmonkeys.de>
date Sun, 27 May 2012 19:30:37 +0200 (2012-05-27)
parents 690:5acc203972f3
children 692:2de21fa40382
files mod_websocket/mod_websocket.lua
diffstat 1 files changed, 5 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/mod_websocket/mod_websocket.lua	Sun May 27 19:05:07 2012 +0200
+++ b/mod_websocket/mod_websocket.lua	Sun May 27 19:30:37 2012 +0200
@@ -262,8 +262,12 @@
 		local frame = parse_frame(data);
 
 		module:log("debug", "Websocket received: %s (%i bytes)", frame.data, #frame.data);
-		if frame.opcode == 0x00 or frame.opcode == 0x01 then -- Text or continuation frame
+		if frame.opcode == 0x0 or frame.opcode == 0x1 then -- Text or continuation frame
 			buffer = buffer .. frame.data;
+		elseif frame.opcode == 0x9 then -- Ping frame
+			frame.opcode = 0xA;
+			conn:write(build_frame(frame));
+			return;
 		else
 			log("warn", "Received frame with unsupported opcode %i", frame.opcode);
 			return;