marlon667's Recent Forum Activity

  • I'm using Rails 4 for my website where I will host my C2 game.

    A user logs into the site, and a session key is stored inside a cookie.

    I need to access that cookie from Construct 2 so I can authenticate with my Websocket server. Is there anyway of accessing that cookie (bearing in mind that the C2 game is just a web page inside a rails s

  • The problem was with <C2PluginRoot>/websocket/runtime.js:142 :

    this.ws = new WebSocket(url_, requireProtocol_ === "" ? undefined : requireProtocol_)

    Replacing this line with the more verbose:

    if (requireProtocol_ === "") this.ws = new WebSocket(url_);

    else this.ws = new WebSocker(url_, requireProtocol_);

    fixes the problem in question, but I'll leave the fix up to you guys.

    Sorry if I wasn't supposed to do that :/

  • Link to .capx file (required!):

    docs.google.com/file/d/0By_A2aN9Y8fyZjdQdHNSUDJOYUE/edit

    Steps to reproduce:

    1. Make sure Chrome Debug Tools are enabled (or different browser equivalent, you need to make sure you can view the headers)

    2. Run the capx. It will try to connect to the echo server (echo.websocket.org)

    3. On Chrome, open the Inspector and go to Network. Filter the results to Websocket. If there are no entries, refresh the page.

    Observed result:

    C2Websocket defines the Sec-Websocket-Protocol header as undefined. This results in a header mismatch with servers that do not define a protocol.

    Expected result:

    Similar to the case of websocket.org/echo.html, Sec-Websocket-Protocol should not exist in the request headers, unless defined. This can be verified by using the above steps on the websocket.org echo page

    Browsers affected:

    Chrome: yes

    Operating system & service pack:

    Windows 7

    Construct 2 version:

    r147 and r146

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Oh ok, will this allow the C2 app to recieve JSON too?

  • Will C2 ever support JSON arrays (or does it already? I haven't found it) Also if JSON is supported, will I be able to send arrays over Websockets?

  • sergyperov

    I took down my example, as I couldn't leave my computer on all the time to host the server. It will go back up soon, but I have to focus on starting my Computing project for my A2. I will put it back up soon, however, hopefully with a video tutorial :)

    On that note, I might as well add that I'm working on a bit Websocket project for my A2 Computing coursework, and when I start, it will be on Github :) I'll post my repo here when I get it up

  • People have been telling me that you have to pay to use their services :/ Besides, My games use WebSockets, that isnt supported by native pps for iOS or Androi, but it is supported by node-webkit.

  • Wow, cool game :)

  • Does this exist?

    I read somewhere that there is a mobile version of Node WebKit for iOS. If this did exist, maybe we could use that instead of PhoneGap or CocoonJS (I have nothing against them, it's just that I don't want to pay <img src="smileys/smiley17.gif" border="0" align="middle" /> also my games use WebSockets)

  • Joannesalfa, I tried numerous times to post a tutorial to go with this example, but I kept getting a Server URI error. I think it has something to do with the Scirra Website, I'm not sure, but I took my example down because I had AS exams and I couldn't leave the server running on my computer.

    Here is the basics of WebSockets:

    WebSockets are upgraded HTTP requests that need a specialised server application to handle them. You can create one yourself, or use an existing Websocket server as a base. I originally used a Node.JS implementation, but I switched to C# for better SQL support.

    The test at websocket.org/echo.html is essentially the same as my .capx file in the sense that it is just a client application. You need to open a Websocket connection to a server application to enable communication.

    There are no hosting services that provide Websocket services per se. A Websocket server is a stand-alone application that you connect multiple clients to.

    If you wanted to work with my example .capx, here's a few things that will help:

    This is a server implementation in C# that I use. The base server allows you to listen for connection requests on a port that you choose, and then accept connections and incomming messages for each connection. What you want to do with those messages is something you have to write yourself.

    In my example .capx, I believe there is a global variable containing the location of the websocket server. If you are running the server on the same computer you use the client, change the server location to localhost. That way you can send messages to your server.

    If you need anymore help, reply here :) I'm gonna try my tutorial again, this seems like a problem for a few people.

  • Hi BasicUser :)

    Sorry, I took down the example because i couldnt keep my computer running all the time. To start using Websockets, you need a server application running on your computer, then you need to poimt your C2 app to it using the Websocket object.

    C2 does not include a way for coding a server but you can find many open source implemenrations on Google.

    The basics of using web sockets is using text messages to communicate with the server. You will need to write your own logic in the client and rhe server as to how your messafes are interpreted. you can find many examples of this on Google :) hope this helps!

  • Ashley rexrainbow

    What I mean is that there isn't any easily accesible debugging tools (that I know off, please tell me!), so maybe integrating previewing in C2 would help solve that problem with breakpoints and watches. And as I said, integrating an IDE purely for coding as an alternative to using events could be used for easier plugin and behaviour creation/debug. Besides, I like IntelliSense :/ and prefer writing code as an alternative to using block events.

    Again, this is just something I thought of that might be useful to game dev in C2, but then again I wasn't sure on the difficulty on implementing this kind of feature. I completely understand you limitations in terms of staff and time :) it's nothing major, i just thought C2 was missing something.

marlon667's avatar

marlon667

Member since 2 Jan, 2013

None one is following marlon667 yet!

Connect with marlon667

Trophy Case

  • 11-Year Club
  • Email Verified

Progress

12/44
How to earn trophies