The Network Watcher is only used when deploying soketi via Kubernetes.
If you run soketi standalone in a cluster at scale, you may run into capacity issues. For example, RAM usage might be near the limit supported by your server and even if you decide to horizontally scale the servers, new connections might still come to servers that are near their memory limit.
Running the soketi Network Watcher inside the same pod will solve these issues by continuously monitoring the soketi Server Usage API, labeling the pods that get over a specified threshold with
ws.soketi.app/accepts-new-connections: "no", so that the services watching for the pods will ignore them.
The Network Watcher is available as a Docker container. It can either be installed manually by adding a container in your pods that also run soketi, or you can use the soketi/soketi Helm Chart, which includes an already-set Network Watcher container you can easily turn on and off.
The following configuration example demonstrates how you may configure the Network Watcher container in your pods that run soketi.
ws.soketi.app/accepts-new-connections: "yes" # required
- protocol: TCP
ws.soketi.app/accepts-new-connections: "yes" # optional
- name: soketi
- containerPort: 6001
- name: network-watcher
- name: KUBE_CONNECTION
- name: MEMORY_PERCENT
value: "75" # if > 75% memory, reject new connections
- name: CHECKING_INTERVAL
value: "5" # every 5 seconds
- name: POD_NAMESPACE
- name: POD_NAME