WebSocket relay server

Creates communication channels between web clients


Allows multiple clients, usually web clients or devices beihind NAT with no direct connectivity with each other to exchange messages. Supported protocols: RAW TCP, TLS, WebSocket and secure WebSocket. Secure connections require a certificate file in the current directory with the name gvalkov.com.pem. The server automatically uses the protocol requested by the client, and falls back to RAW if no protocol is detected. Port 81 is used by default, see G_SOCKET::config in g_socket.cpp. Cube3D_devicemotion can be used as a sample client, where one device shares its accelerometer data with another. Browsers should display rotating cube.

Command line options

g_relay <-p listen port><-c connections><-L packet length>
-pListen port
-c1-32Number of connections
-LPacket length e.g. 1472 1405 1422 65112 65507

Video demo Accelerometer 3D cube + WebSocket relay

Accelerometer 3D cube + WebSocket relay

Supported Platforms

☂︎ Apple iOS, macOS
☂︎ FreeBSD
☂︎ Linux, OpenWRT
☂︎ Windows

Prerequisites and build instructions

© 2014-2023 Georgi Valkov