No SSL in libwebsockets

Branch: 4.4

Home Premium 64bit

Visual Studio Express 2013 for Windows Desktop


I was trying to establish an secure websocket connection, but the libwebsockets printed an error:

libwebsockets not configured for ssl

I checked the libwebsockets’ source code on github and probably the library in UE4 was built with no LWS_OPENSSL_SUPPORT define.

Is it intentional? It would be nice to have an SSL in websockets.

You can try to enable it yourself in your UE4 source code copy, but considering its disabled it may not work.

Just adding this define won’t work, the library has to be compiled with this define. I’m trying to do this but I have problem with correct linking (unresolved external symbols). Anyway, wouldn’t be nice to have it enabled by default?

Yes the library was built without SSL suppport. If you need SSL Support you could just build it again. The use case right now ( Cook on the fly ) didn’t warrant SSL support. But when we get to networking for HTML5, maybe.

Ok, I figured out how to properly build this library with SSL support and it works. But still it would be brilliant if SSL in websockets and http was out of the box.

Hi zompi2,

I am glad to hear that you were able to get this working for you. Would you be able to post an answer explaining what you did in case anyone else needs help with this same issue?

Ok, it was quite a battle but it’s working now, this is what I did:

I downloaded sources of OpenSSL ( /source/index.html ) and libwebsockets ( GitHub - warmcat/libwebsockets: canonical libwebsockets.org networking library ).

Then I built OpenSSL like in this description Come Join the Covenant Eyes Team! (remember that we need x64 version!)

Now with good OpenSSL static libraries it’s time to build libwebsockets. First we need visual studio solution, CMake is a tool that can generate it. In command prompt go to the directory where your libwebsockets sources are and type:

mkdir Build
cd Build
cmake .. -G "Visual Studio 12" -DOPENSSL_ROOT_DIR="C:\OpenSSL\Build"

Where “C:\OpenSSL\Build” is a place where is your OpenSSL build from previous step.

Now in Build directory in libwebsockets sources directory there is libwebsockets.sln, run it.

You can remove all projects except ZLIB and websockets from the solution. Also remove CMakeLists.txt from this projects so CMake will not generate the whole solution again.

Now change Debug Win32 to Release x64 and build the solution. (LWS_OPENSSL_SUPPORT is set on be default).

The only thing left is to put newly built libs and headers from OpenSSL and libwebsockets to proper directories in ThirdParty and everything should work like a charm.

For me now the only thing left is to build libraries for iOS and Android but it will be another story.

is there any out of the box solution to use ssl?
what do i have to do to activate ssl for mobile?

I write a plugin to let people easy to use web socket, you can use c++ or blueprint to finish your work.
https://github.com/feixuwu/UEWebsocket