Comparison

net/websocket.lua @ 6455:b6514e691a70

net.websocket: Make data masking configurable
author Florian Zeitz <florob@babelmonkeys.de>
date Fri, 26 Sep 2014 22:12:21 +0200
parent 6407:4bbd198cf3e6
child 7759:69706084bdfe
comparison
equal deleted inserted replaced
6448:f799b45cf735 6455:b6514e691a70
132 if self.readyState < 2 then 132 if self.readyState < 2 then
133 code = code or 1000; 133 code = code or 1000;
134 log("debug", "closing WebSocket with code %i: %s" , code , tostring(reason)); 134 log("debug", "closing WebSocket with code %i: %s" , code , tostring(reason));
135 self.readyState = 2; 135 self.readyState = 2;
136 local handler = self.handler; 136 local handler = self.handler;
137 handler:write(frames.build_close(code, reason)); 137 handler:write(frames.build_close(code, reason, true));
138 -- Do not close socket straight away, wait for acknowledgement from server. 138 -- Do not close socket straight away, wait for acknowledgement from server.
139 self.close_timer = timer.add_task(close_timeout, close_timeout_cb, self); 139 self.close_timer = timer.add_task(close_timeout, close_timeout_cb, self);
140 elseif self.readyState == 2 then 140 elseif self.readyState == 2 then
141 log("debug", "tried to close a closing WebSocket, closing the raw socket."); 141 log("debug", "tried to close a closing WebSocket, closing the raw socket.");
142 -- Stop timer 142 -- Stop timer