RLS Studios
ProjectsPatreonCommunityDocsAbout
Join Patreon
BeamNG Modding Docs

Guides

Reference

cdefDebugDraw ReferencecdefGpuMesh ReferencecdefImgui ReferencecdefMath Referencecdefs ReferencecontrolSystems Referencecsvlib ReferencedelayLine Referencedequeue ReferencedevUtils ReferenceEvent Referenceextensions Referencefilters Referencegraphpath Referenceguihooks ReferenceinputFilters ReferenceinterpolatedMap Referenceintrospection ReferencejbeamWriter Referencejson-ast Referencejson ReferencejsonDebug ReferencejsonPrettyEncoderCustom Referencekdtreebox2d Referencekdtreebox3d Referencekdtreepoint3d Referencelpack ReferenceluaBinding ReferenceluaCore ReferenceluaProfiler Referencemathlib Referenceparticles Referencequadtree Referencesettings ReferencetcpServer ReferencetimeEvents Referenceutils Reference
calltracer ReferencedateUtils ReferencedebugDraw Referencefilterchain Referenceutils/ - Utility Modulesheatmap ReferencehttpJsonServer ReferenceinteractiveShell ReferencelanguageMap Referenceperf Referencepixellib ReferencesimpleHttpServer ReferencetorqueScriptParser ReferencewsUtils Reference

UI

Resources

BeamNG Game Engine Lua Cheat SheetGE Developer RecipesMCP Server Setup

// RLS.STUDIOS=true

Premium Mods for BeamNG.drive. Career systems, custom vehicles, and immersive gameplay experiences.

Index

HomeProjectsPatreon

Socials

DiscordPatreon (RLS)Patreon (Vehicles)

© 2026 RLS Studios. All rights reserved.

Modding since 2024

API Referencecommonutils

wsUtils Reference

Module defined in `lua/common/utils/wsUtils.lua`. WebSocket server creation and management utilities using BeamNG's `BNGWebWSServer` API.

Module defined in lua/common/utils/wsUtils.lua. WebSocket server creation and management utilities using BeamNG's BNGWebWSServer API.


Exports

Functions

M.createOrGetWS(listenAddr, port, path, protocolName, redirPage, enableDataStreams)

Create or retrieve an existing WebSocket server, auto-detecting the best network adapter.

  • Parameters:
    • listenAddr - string - Listen address
    • port - number - Listen port
    • path - string - WebSocket path (e.g., "/")
    • protocolName - string - WebSocket protocol name
    • redirPage - string|nil - HTTP redirect page for non-WS requests
    • enableDataStreams - boolean|nil - Enable data streaming (default: true)
  • Returns: BNGWebWSServer, string - Server object and chosen IP address

Internal Notes

  • Auto-tests each network adapter by creating a test client connection
  • Skips VirtualBox and VMware virtual adapters
  • generateRandomData creates random strings for connection testing
  • testWSConnection validates bidirectional data transfer before selecting adapter
  • Data streams enabled by default unless explicitly disabled

torqueScriptParser Reference

Module defined in `lua/common/utils/torqueScriptParser.lua`. Parses TorqueScript source code into an AST using PEG (Parsing Expression Grammar).

simpleProfiler/report Reference

Module defined in `lua/common/utils/simpleProfiler/report.lua`. Generates flame chart HTML reports from profiling data using Mustache templates.

On this page

ExportsFunctionsM.createOrGetWS(listenAddr, port, path, protocolName, redirPage, enableDataStreams)Internal Notes