[r139] WebSocket plugin error

0 favourites
  • 4 posts
From the Asset Store
Use this game pack to create your own game, modify the existing game or simply take a look and see how it was made.
  • Link to .capx file (required!):

    mediafire.com

    Steps to reproduce:

    1. I added a textbox and a button.

    2. When i set the event On clicked... Connect to txtHost.Text (which is the textbox).

    3. When it try to connect to a not available server.. it seem to do this..

    Observed result:

    <img src="http://s23.postimg.org/sgs9dbcwb/websocket_error.png" border="0" />

    Expected result:

    No js error message.

    Browsers affected:

    Chrome: yes

    Firefox: yes

    Internet Explorer: yes

    Operating system & service pack:

    Windows 7, latest service pack

    Construct 2 version:

    r139

  • Just want to add a note.. actually there doesn't seem to have any way to detect if a connection couldnt be established. If we fellow the draft from dev.w3.org/html5/websockets there are return codes. 1006 should be the returned code for such closure.. however the plugin doesn't allow for getting this value.

    This should do the job.. (rest of code not shown.. but easy to figure out)

    this.ws.onclose = function (evt_) {

       self.code = evt_.code;

       self.runtime.trigger(cr.plugins_.C2WebSocket.prototype.cnds.OnClosed, self);

    };

    Also i think i fixed the bug... _err must not be used directly. _err.data must be used. This is still an event like any other event of websockets.

    I worked a lots with websockets so i hope ive helped a bit! <img src="smileys/smiley1.gif" border="0" align="middle" />

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Did you test in r144.2? We fixed some related issues recently already. I've made some further changes for the next build anyway (added CloseCode and CloseReason expressions; made sure the error message is read properly).

    Note: please don't adjust official plugins. It's better to suggest the code changes then allow us to make them through official builds. Anyone using that plugin you provided will now have compatibility difficulties with the official plugin that will come in the next build.

  • Hi Ashley,

    Thanks for your reply. Nah, sorry i am rather new here i didn't tried r144.2 because it was a beta version (and i wanted something stable to start on) but to be honest i didn't know changes was made concerning WebSockets in there. Next time i will suggest code instead and have a look at the beta release first :) But thanks for your support!

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