From 93fb40ad7d259785a22c895e8e24e587ec22f43f Mon Sep 17 00:00:00 2001 From: lampysprites Date: Mon, 18 Oct 2021 23:38:45 +0700 Subject: [PATCH] Expose min/max time between websocket reconnects --- src/app/script/websocket_class.cpp | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/src/app/script/websocket_class.cpp b/src/app/script/websocket_class.cpp index 9aaab4519..fd46b5495 100644 --- a/src/app/script/websocket_class.cpp +++ b/src/app/script/websocket_class.cpp @@ -55,7 +55,19 @@ int WebSocket_new(lua_State* L) } lua_pop(L, 1); - int type = lua_getfield(L, 1, "onreceive"); + int type = lua_getfield(L, 1, "minreconnectwait"); + if (type == LUA_TNUMBER) { + ws->setMinWaitBetweenReconnectionRetries(lua_tointeger(L, -1)); + } + lua_pop(L, 1); + + type = lua_getfield(L, 1, "maxreconnectwait"); + if (type == LUA_TNUMBER) { + ws->setMaxWaitBetweenReconnectionRetries(lua_tointeger(L, -1)); + } + lua_pop(L, 1); + + type = lua_getfield(L, 1, "onreceive"); if (type == LUA_TFUNCTION) { int onreceiveRef = luaL_ref(L, LUA_REGISTRYINDEX);