FSocket in HTML returns false even connection is a success
Currently I'm trying to export a simple topdown template to html5 with a custom written c++ class using FSocket to enable blueprinting tcp sockets for UE4 designers in our company. We have a node.js backend that accepts both TCP and Websocket connections on different ports.
When I run the current game in editor (or export for mac osx), a TCP connection is made and data send and receive has no problems.
However after exporting to HTML5, the websocket connection is made, yet the FSocket->Connect() always return false. There are no logs or errors about the condition of the connection on browser console log, but I can see a successful connection made on the server part.
This is the header that UE4 is sending when game is run in HTML5.
Here is the code I'm using to connect to the current backend.
Is there any other way of using the FSocket to enable HTML5 networking / websockets ? Are there any tutorials/codes that I can look at for understanding the concept as the documentation does not exist.
Couple of things -
HTML5 networking plugin has nothing to do with what you are trying to do. It is only used for multiplayer. you can safely disable that.
emscripten toolkit wraps websocket with the bsd networking api with a best effort implementation, which is then wrapped by FSocket classes.
The problem which I think you are facing is that there's is no synchronous connect for web sockets and hence the synchronous Connect ( which works on all other platforms as advertised) returns false.
answered Jul 27 '15 at 02:24 PM
Follow this question
Once you sign in you will be able to subscribe for any updates here