WebSocket Header Problem

Get help using Construct 2

Post » Thu Oct 24, 2013 1:24 pm

Hi,

since I already learned some basic skills to create a game with Construct 2 I wanted to create a simple turn-based multiplayer game.

The GameLogic will be running on a server, and since I'm interested in learning about JEE too, I developed the server in Java using the javax.websocket.* stuff.

The problem is: if I use some JavaScript for testing purposes everything works fine. If I test the same things in Construct 2 (connecting and sending text / receiving text) the connection gets established (at least the server tells me that the client had successfully connected and did not yet disconnect/close) but inside Chrome in the Network Tab of the Developer Tools in the Frames section there is an error saying "Invalid UTF-8 sequence in header value".

In addition, I get the following errors inside the Developer Tools:

WebSocket connection to 'ws://localhost:8080/game/gameendpoint' failed: Invalid UTF-8 sequence in header value C2WebSocket_plugin.js:142
[Construct 2] Suspending common_prelude.js:33
[Construct 2] Resuming common_prelude.js:33
[Construct 2] Suspending common_prelude.js:33

Since it works if I open a static HTMl/JS it must be a mistake in Construct I think.

The server runs (as one can see) on my local machine.


Hopefully someone can help me get this working.

Thank you for reading!
B
4
S
1
Posts: 2
Reputation: 254

Post » Thu Oct 24, 2013 3:14 pm

How do you execute the javascript ? With the Browser Object or do you work with websockets ?

Edit: Sry read to fast I see you use Websockets

try wss instead of ws

and set the header right, looks like your server dont accepts a UTF-8 message


WikiDarklinki2013-10-24 15:21:01
B
15
S
6
G
6
Posts: 512
Reputation: 5,555

Post » Thu Oct 24, 2013 3:58 pm

Thank you for your response.

I tried wss, but there were no connection.

Regarding the header, I do not set the header(s) manually, since I'm using the JEE classes which do this internally I think.

I'm open for further suggestions...



edit:

Because I have the urging need to fulfill my functionality in this game, I chose to implement my WebSocket-Server in C# instead of Java, using a more simplistic framework which works out of the box with Construct 2.eoiser2013-10-25 13:11:38
B
4
S
1
Posts: 2
Reputation: 254


Return to How do I....?

Who is online

Users browsing this forum: brunopalermo and 27 guests