Can't get socket.io to connect to an address

0 favourites
  • 9 posts
From the Asset Store
Using this example, you can create a connect mahjong game. So you can customize this example for your own game.
  • Hi,

    I just made a simple socket.io test game, and even though I've specified a valid address and port I can see that my Construct 2 game is trying to connect to "undefined" rather than "http://myaddress.com".

    Is this something you're familiar with?

    I'd post an example, but I can't due to the bug described here.

    Thanks a lot guys.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • We don't officially support socket.io. Can you tell me a bit more about what you are trying to do? Are you writing a third party plugin? What specifically do you think is the problem in C2?

  • SocketIO doesn't connect via http, try using a ip address instead.

    I also think the default port is 8099 and not 80(http).

    When you get the black screen of death fixed, post a capx.

  • bolosaur

    You can't access socket.io functionality directly from Construct 2. So are you

    a) using one of the existing thitd-party socket.io plugins, or

    b) (as Ashley suggests) writing a socket.io plugin yourself?

    And in that case why have you come to the conclusion that your connection failure is due to a C2 bug rather than a plugin bug?

  • Ashley

    I'm using the "Socket" plugin that comes with Construct 2. I'm trying to connect it to a node.js server I've got running with socket.io, and it resolves perfectly fine when I'm testing it through other means. When I'm using Construct 2's Socket plugin however, it doesn't seem to use the value I provide in the "Connect" function of the plugin, as whenever I test my game it just tries to connects to "http://undefined/socket.io/1/whatever" according to the Firebug console.

    Taurian

    What do you mean it doens't connect via HTTP? Isn't that how WebSocket tries to establish a connection? Also, the default port doesn't matter as far as I know, because it's set to "80" on both ends.

    Velojet

    I'm using the built-in "Socket" plugin. I'm also not claiming that it's a Construct 2 bug, but I assumed it could be posted here as the plugin is included with Construct 2, or maybe I'm wrong about that?

  • <img src="http://images.fungopher.com/C/s/T/CsTjTzofb/Funny-Animals-I-give-up-I-m-too-tired-to-argue.jpg" border="0" />

    Post a .capx

  • bolosaur - you must be mistaken. There is no official socket plugin for Construct 2. You must have found a third party one and unfortunately it's not our responsibility to fix third party code!

  • I'm using the built-in "Socket" plugin. I'm also not claiming that it's a Construct 2 bug, but I assumed it could be posted here as the plugin is included with Construct 2, or maybe I'm wrong about that?

    bolosaur

    I'm afraid you are wrong about that - sorry. As Ashley says there is no socket.io plugin included with Construct 2, so if there's a bug, it's not in C2 or its own component plugins.

    Where did you get the socket.io plugin from?

  • Closing since it's a third party issue.

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