Skip to content
Jirka Dell'Oro-Friedl edited this page Sep 19, 2022 · 6 revisions

FudgeServer

FudgeServer is a script for node.js that contains all fundamentally necessary logic to setup the network infrastructure, dispatch messages and manage so called "rooms", which are groups of connections to separate e.g. game instances. The server may run as localhost on a single machine for testing or on some machine in the network. Use the WebSocket-protocol ws:// to connect to a running instance of FudgeServer.

All clients must connect to FudgeServer. It generates ids for the clients and rooms that serve as adresses for messages. Messages may be routed from one client to another or broadcast to all other clients in the room via the server using the WebSocket connections. FudgeServer also acts as the signalling server to establish WebRTC-connections. Therefore, it can automatically setup the mesh or WebRTC-host structure. The server sends a heartbeat to all clients every second, so clients can easily check if their connection to the server still works.

If no further functionality is required on the server side, an instance of FudgeServer may simply be created and ready to use with the following two lines in your node script for your server, where port is the number of the port your server listens on.

let server: FudgeServer = new FudgeServer();
server.startUp(port);

However, it is possible to create a subclass of FudgeServer and extend its functionality.

Clone this wiki locally