plugins/keepalive.lua

Thu, 10 Jun 2021 11:58:23 +0200

author
Kim Alvefur <zash@zash.se>
date
Thu, 10 Jun 2021 11:58:23 +0200
changeset 445
b119dc4d8bc2
parent 250
a5ac643a7fd6
permissions
-rw-r--r--

plugins.smacks: Don't warn about zero stanzas acked

It's only if the count somehow goes backwards that something is really
wrong. An ack for zero stanzas is fine and we don't need to do anything.

local verse = require "verse";

function verse.plugins.keepalive(stream)
	stream.keepalive_timeout = stream.keepalive_timeout or 300;
	verse.add_task(stream.keepalive_timeout, function ()
		stream.conn:write(" ");
		return stream.keepalive_timeout;
	end);
end

mercurial