Node.js UDP proxy for Valheim server Systemd socket activation
Node.js UDP proxy for Valheim server Systemd socket activation
I wanted to host Valheim[0] for my friends using a dedicated server on my home box. The server can be heavy, so I didn't want it running 24/7. Systemd has a feature called "socket activation" where it listens to sockets on behalf of your service and then starts it up on-demand when there is traffic on the socket. Unfortunately Valheim's server does not support this, so a proxy must be used. Double unfortunately, the Systemd provided systemd-socket-proxyd[1] doesn't support UDP, which the game uses. To resolve this, and half as a learning exercise, I wrote my own small UDP proxy[2]. It opens a socket to the Valheim server for every incoming client address/port combination, so that replies can be routed back to the originating client. I would have written it in Erlang (using Gleam), but Erlang is not currently able to use the socket provided by Systemd. Node.js was a pragmatic choice based on ease of installation/setup and familiarity with JavaScript and the APIs. The proxy seems to be running smoothly, and the server is started and shut down automatically by Systemd (as the proxy shuts itself down after a period of inactivity). The only remaining problem currently is that the server takes too long to start in the eyes of the game client, and thus the first connection attempt will always fail. For a server between friends, this is a minor issue. I have also written a more detailed post about the process on my blog[3] if someone happens to be interested, but this post already contains most of the important stuff. [0] https://www.valheimgame.com [1] https://man.archlinux.org/man/core/systemd/systemd-socket-pr... [2] https://git.ahlcode.fi/nicd/valproxy [3] https://blog.nytsoi.net/2024/07/18/valheim-systemd-socket-ac...
Share cardActual performance
Launch Intel predictions
Analyze your own launch →Incorrect prediction on native model
Similar products
Kamote Node.js RPC Server now supports callbacks
Node.Js server-side framework
Vim2html for node.js
TDD Given-When-Then for Node.js
Coolx5 - Node.js, Websockets, MongoDB and a clickable zombie
Yet Another Node.js Logger – femto-logger
HTML5 MMORPG – Node.js
Regex Expansion in Node.js
Norby – Call your Ruby libraries from Node.js
A Node.js delta encoder