[plugin] socket.io 1.x

0 favourites
From the Asset Store
Shark.io
$49 USD
Shark.io in the sea full of killer sharks, Sunday of life is the game. Who knows what is happening under the sea?
  • Just to help someone else out that may be stuck on this.

    Download Node.js from http://nodejs.org/

    After you have done this, check C:\Users\YOURCOMPUTERNAME\AppData\Roaming for a directory called npm

    If it does NOT exist, make the directory and call it npm

    Then start a command prompt, see to it that you use RUN AS ADMINISTRATOR, go into the directory whereever you uncompressed the socket.io file and go to the server directory

    Now type npm install. It should find all the dependencies correctly.

    If you get npm ERR! or ENOENT, open xxxxxx this means usually that the directory npm is not created. Also check your PATH and see that the npm is in your path.

  • Cybergod

    Thanks for testing this plugin and providing useful info! If you've got any feedback on this plugin i hope you'll post it here...

    Cheers!

  • Index

    I've updated the plugin to 1.2.1 version, tests are ok. Please test and redownload. The .c2addon file is also updated!

    Cheers!

  • JohnnySheffield, are you gonna be setting up another place to host the repository for your plugin? I may wind up using it for a school project, and I don't wanna see it cast into oblivion. [quote:388bvj5u]This service will die on 31.12.2014. Run for your lives. See you on git.nodepie.ninja

  • DatapawWolf

    Don't worry, i wrote that message!

    Cheers, and happy holidays!

  • JohnnySheffield oh I see! Well good to know. Thanks for the reply.

  • (Solved this issue in the next post, so skip this)

    So I'm not sure why but when I use

    <html>
    Blank Page *shrugs*
    
    <script src="/socket.io/socket.io.js"></script>
    <script>
      var socket = io('(omitted)');
      socket.emit('my other event', { my: 'data' });
      socket.on('news', function (data) {
        console.log(data);
        socket.emit('my other event', { my: 'data' });
      });
    </script>
    
    </html>
    [/code:sstvnrqd]
    
    It works. Yet, when I try to do the same thing in construct 2 it doesn't work. I get multiple (usually two) connection events firing. The plugin event "open" fires but "connect" never does even when the server claims I've joined a room etc. Events don't transfer between server and client... (neither wildcard or messages in either direction).
    
    yet, once again that HTML works- including transferring events with that HTML and getting an event as a response. Just not with the Socket.IO plugin going to the same URL and everything.
    
    Does it have maybe something to do with this line in runtime.js?
    
    [code:sstvnrqd]
    this.manager = window["io"]["Manager"](url, this["options"]);
    [/code:sstvnrqd]
    
    Does 
    [code:sstvnrqd]
    window["io"]["Manager"](url); 
    [/code:sstvnrqd]
    
    perform the same way as?
    [code:sstvnrqd]
    var socket = io(url);
    [/code:sstvnrqd]
  • ^ Finally figured it out after looking at your example and staring at it.

    You cannot leave namespace blank or the program acts normal but doesn't actually do anything. It will even show relatively the same debug dialog. It will connect very similar. However, it wont receive or send events properly. Nor will it actually "connect" it will just "open" even though it triggers a "connect" on the server.

    To remedy all this you NEED to put "/" in namespace to connect to the default namespace OR likely end the URL with a slash such as , scirra.com/ and NOT scirra.com.

    Hope nobody else runs into this for as long as I did. Just happy it's finally fixed.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Index Hello, would you mind to upload this current plugin? the download link is broken now and the author is missing (no reply during weeks), there no choice to get this plugin.

  • Joannesalfa http://www.mediafire.com/download/3se67 ... client.rar Noncentz705

    That is the last version that I had downloaded. Should be the 1.1 version.

  • Index thanks.

  • How to receive emitted "event" data

    The program connects to the server successfully.

    I emit messages to the server every 5 seconds successfully (server outputs the data sent)

    The server emits a message every second.

    All works AS LONG as the server emits the message with event "message".

    ex:

    socket.emit("message", "Hello World"); from server Works with construct socket.io client on Message event

    BUT

    socket.emit("setText1", "Test"); from server does not get caught by construct socketio client on Message nor on Event / wild card event

    How can I catch events sent from the server ... I assume using On Event or wildcard event, but I'm apparently doing something wrong as it does not catch these.

  • Okay...I think I understand now...the wildcard event has to be denoted on the server as event '*' and then you pass an array of data which includes the actual event and data.

    Unfortunately not what I wanted, but I get it.

  • For some time now i've been inactive with this developing and maintaining this plugin, and I apologize for that. It's simplest to say, life got in the way, but the motivation drained off and without proper incentive it's hard to justify spending my hours daily/weekly in developing new plugins and maintaining existing ones. It's not matter of greed, or dissatisfaction, but mere practicality. Bills are arriving every month, and my kid needs something to eat.

    Anyways, i'm quite happy there are people finding this plugin useful, and there are people that are going to continue to update it, work on it for the benefit of the community. As for the community, I humbly ask you, please please learn JavaScript, learn Git, and start to actively contribute to maintaining all of the plugins that are here for you. It's not that hard, if you can use C2, you're well enough to grasp concepts behind git and JavaScript, it's not such a big of a leap, just some learning and playing with it. Learn and evolve!

    Enough bullshitting, I've pushed the repo to the new git server, and updated the first post, so the version 1.2.1 is available. Also, the history of commits is also there, so if anybody is willing to dig into this plugin, please look into the prior versions, it should be clear enough to do your own thing with this code!

    Love you all,

    Cheers,

    Johnny

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