Is it possible to run the game server for a multiplayer game in HTML5?

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By chris18191

Scenario: I had the idea of creating a simple quiz game for me and my housemates, which would be hosted as an HTML5 export on my remote server. This server is just an old PC of mine and thus I thought of making one of the players, that downloaded the game over their browser, the game server itself, so that this player has one server instance running and in parallel the normal game client to play. In the next step there would be some sort of network discovery to find this running instance at the other clients.

Goal: Decentralised hosts for LAN multiplayer in HTML5 exports.

Question: Can I run a server over one of the implemented network protocols of the engine or is there some restriction of the browser to disallow creating servers for security reasons?

Additional: WebsocketServers are noted to not work within HTML5, but why is this?

Thanks for your help,


:bust_in_silhouette: Reply From: Calinou

Due to browser security restrictions (on top of port forwarding issues that would stem from player-hosted servers), there is no way to run a WebSocketServer from HTML5. You have to use a dedicated server to host the WebSocketServer.