diff --git a/lua_examples/webap_toggle_pin.lua b/lua_examples/webap_toggle_pin.lua
index ddc09d36..d70adcdd 100644
--- a/lua_examples/webap_toggle_pin.lua
+++ b/lua_examples/webap_toggle_pin.lua
@@ -26,6 +26,6 @@ srv:listen(80,function(conn)
end
buf = buf.."";
client:send(buf);
- client:close();
end)
+ conn:on("sent", function (c) c:close() end)
end)