WebSocket support?

How does UE4 handle networking under HTML5 builds? Are websockets supported?

Here’s an experimental networking plugin that uses websockets, I think.

I have made a naive implementation via GitHub - novnc/websockify: Websockify is a WebSocket to TCP proxy/bridge. This allows a browser to connect to any application/server/service., but this is far from good: a good native implementation would be much better.

HTML5 Multiplayer is supported via the plugin Experimenta\HTML5Networking. ( https://github.com/EpicGames/UnrealEngine/tree/master/Engine/Plugins/Experimental/HTML5Networking ) Readme.md in the same directory explains how to set that plugin. Discovery eg, Beacons are not supported out of the box.

Emscripten supports websockets out of the box via the BSD socket api. HTML5 networking plugin on the client side uses it and on the server side uses libwebsocket.org. this plugin is also cross platform - if non html5 clients want to talk to the same server ( the one which HTML5 platform connects), they can use the same plugin.

libwebsockets.org lib is also used for Cook-on-the-fly feature for HTML5 platform. (although that is only done via http requests).

This plugin is a “native implementaiton” and allows Unreal Servers to understand websockets. This was used by mozilla to demo ShooterGame+Networking (HTML5 clients playing against themselves and win64 clients) at GDC.

Websockify is not necessary with this plugin.

Would it be possible to run the Shooter Game project along with this plugin, without modifications to the Shooter Game code? Or are any kind of fixes needed? Is this for 4.6 or 4.7?

You should be able to run Shooter Game without modification ( although its not technically supported on html5 yet- there might be some graphical glitches on html5 with stock github ue distribution). Networked gameplay should work without any changes.

Server discovery won’t work though - you would have to use the server ip on the html5 command line ( edit the generated html5 file for that).

if You are trying to get your feet wet - it would be easier to get a handle on things with smaller projects eg - ContentExamples ( networking features map ) or the Shootout networking tutorial.

In its current state it is for 4.8, although making it work for 4.7 is straightforward too.

Tuning down the graphics and/or tweaking the shaders to mobile-friendly would probably make it run without problems on HTML5, maybe?

yes - to get around most graphical issues in html5 ( and ShooterGame) you can relax es2 sampler limits. you can locally change GetFeatureLevelMaxTextureSamplers to return always return 16. ( HTML5 is a “High End” es2 device). Engine\Source\Runtime\RHI\Public\RHIDefinitions.h line ~725. And then cook content.