[plugin] socket.io 1.x

Post your work in progress addons and get feedback

Post » Tue Dec 30, 2014 2:07 am

@DatapawWolf

Don't worry, i wrote that message! :) I'm currently in a migration process to a new domain with a newer instance of gitlab over on git.nodepie.ninja. Some interesting stuff is developed there already, and all of my plugins will be available there, including socket.io. A new socket server is also in the works! :)

Cheers, and happy holidays!
Be nice until it's time to not be nice
B
36
S
10
G
9
Posts: 293
Reputation: 6,712

Post » Tue Dec 30, 2014 6:43 pm

@JohnnySheffield oh I see! Well good to know. Thanks for the reply. :)
ImageImageImageImage
B
62
S
19
G
51
Posts: 633
Reputation: 30,826

Post » Sun Jan 04, 2015 6:11 pm

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

So I'm not sure why but when I use

Code: Select all
<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>


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: Select all
this.manager = window["io"]["Manager"](url, this["options"]);


Does
Code: Select all
window["io"]["Manager"](url);


perform the same way as?
Code: Select all
var socket = io(url);
Last edited by Index on Sat Jan 10, 2015 9:10 am, edited 1 time in total.
B
73
S
10
G
6
Posts: 105
Reputation: 7,577

Post » Sat Jan 10, 2015 5:34 am

^ 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.
B
73
S
10
G
6
Posts: 105
Reputation: 7,577

Post » Thu Apr 02, 2015 7:04 pm

@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.
B
97
S
35
G
29
Posts: 3,139
Reputation: 28,371

Post » Thu Apr 02, 2015 7:13 pm

@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.
B
73
S
10
G
6
Posts: 105
Reputation: 7,577

Post » Thu Apr 02, 2015 8:40 pm

@Index thanks.
B
11
S
2
G
1
Posts: 202
Reputation: 1,580

Post » Sat Apr 18, 2015 4:12 pm

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.
B
18
S
6
G
2
Posts: 27
Reputation: 2,945

Post » Sun Apr 19, 2015 1:03 am

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.
B
18
S
6
G
2
Posts: 27
Reputation: 2,945

Post » Wed Apr 29, 2015 7:19 am

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
Be nice until it's time to not be nice
B
36
S
10
G
9
Posts: 293
Reputation: 6,712

PreviousNext

Return to Work in Progress Addons

Who is online

Users browsing this forum: No registered users and 1 guest