Building luasec as native extensions

There’s nothing special with how secure web sockets are created from the clients perspective. The handshake will happen in the websocket client code. Check the Defold client for Colyseus for use of websockets and luasec: https://github.com/gamestdio/colyseus-defold

1 Like

Actually, I do not know how to pass the ssl_params to the async websocket client, the colyseus client example does not use secure websockets either.

@sonountaleban How do you fix the duplicate symbols issue and get lib openssl built with Defold native extension? I tried to use you libs in my native extension and get ‘Undefined symbols’ errors, so it would be great if you can share you build process. Thanks in advance.

Well, I saw that there wasn’t a way to pass the SSL parameters to the async websocket client. Sorry about that! I’ve upgraded the lib so that it handles the parameters: https://github.com/britzl/defold-websocket/blob/master/websocket/client_async.lua#L171-L174

Note: I wasn’t able to get wss:// working on HTML5 builds. It seems to still want to connect to ws:// but with port 443.

@joshua.winters In our next release, we have renamed our internal libcrypto functions, so that you should be able to use vanilla OpenSSL without getting “Duplicate symbols”.

2 Likes

This is really a great news for me! Thanks @Mathias_Westerdahl for the update.

1 Like

Hi there,

I’m kinda in desperate mode here. I can’t compile my project anymore when adding luasec as a dependency. It takes forever to build and never launches (waited +15minutes to be sure, and it won’t compile), even from an empty project including luasec as dependency.

At first I thought it was an editor issue, since it started to happen after upgrading to v1-2-134. Then I’ve downgraded to v1-2-133, without success. Same problem. :sob:

Unfortunately, I can’t see any useful information in the editor log files.

Video recording (my cursor was indicating “loading”, it doesn’t show in the recording):

I’d appreciate if you could give me any direction since I’m pretty lost at this point.
Thanks a lot!

2 Likes

Hmm, it builds just fine for me. Do you use any other native extensions? Could you please try another one? Can you reach https://build.defold.com/?

1 Like

Hey @britzl, thanks for replying. It seems I was having issues with my internet service provider, my upload rate was close to zero last week. Do Defold upload every build to https://build.defold.com? Cheers!

No, it should cache the engine once it is built. If you change a native extension then you need to rebuild (and this will send to our build server).

2 Likes