You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Refactor connection TTL logic in WS server (#1678)
* feat: change behaviour of auto disconnect
Signed-off-by: Ivo Yankov <[email protected]>
* chore: fix failing after hook
Signed-off-by: Ivo Yankov <[email protected]>
* fix: subscriptioController unit tests
Signed-off-by: Ivo Yankov <[email protected]>
* refactor: update var names to be more descriptive
Signed-off-by: Ivo Yankov <[email protected]>
* docs: update env var description
Signed-off-by: Ivo Yankov <[email protected]>
---------
Signed-off-by: Ivo Yankov <[email protected]>
|`SUBSCRIPTIONS_ENABLED`| "false" | If enabled eth_subscribe will be enabled using WebSockets. |
101
+
|`WS_MAX_INACTIVITY_TTL`| "300000" | Time in ms that the web socket connection is allowed to stay open without any messages sent or received, currently 5 minutes. |
102
+
|`WS_CONNECTION_LIMIT`| "10" | Maximum amount of concurrent web socket connections allowed. |
103
+
|`WS_POLLING_INTERVAL`| "500" | Time in ms in between each poll to mirror node while there are subscriptions. |
104
+
|`WEB_SOCKET_PORT`| "8546" | Port for the web socket connections |
105
+
|`WEB_SOCKET_HTTP_PORT`| "8547" | Port for standard http server, used for metrics and health status endpoints |
106
+
|`WS_SUBSCRIPTION_LIMIT`| "10" | Maximum amount of subscriptions per single connection |
107
+
|`WS_CONNECTION_LIMIT_PER_IP`| "10" | Maximum amount of connections from a single IP address |
108
+
|`WS_MULTIPLE_ADDRESSES_ENABLED`| "false" | If enabled eth_subscribe will allow subscription to multiple contract address. |
109
+
|`WS_CACHE_TTL`| "20000" | The time to live for cached entries. |
110
+
|`WS_PING_INTERVAL`| "1000" | Interval between ping messages. Set to `0` to disable pinger. |
logger.info(`${connectionIdPrefix}${connectionRequestIdPrefix} New connection established. Current active connections: ${ctx.app.server._connections}`);
@@ -136,7 +137,8 @@ app.ws.use(async (ctx) => {
136
137
limiter.applyLimits(ctx);
137
138
138
139
ctx.websocket.on('message',async(msg)=>{
139
-
ctx.websocket.id=relay.subs()?.generateId();
140
+
// Receiving a message from the client resets the TTL timer
0 commit comments