WebSocket Header Problem

0 favourites
  • 3 posts
  • 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!

  • 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


  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • 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...


    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.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)