[PLUGIN] Zack0Wack0's Socket.io mod

Post your completed addons to share with the community

Post » Fri Sep 07, 2012 4:12 am

EDIT2: I became a father month ago, so I haven't got time to sort this plugin and post to some decent level of tidyness. I believe I'll manage to find some time in the next week, so i'll re-upload the plugin with some modifications and hopefully new possibilities!

EDIT: You can download more stable version of this plugin(without new ACE's except send custom event(aka emit), but with minify problem sorted out): Link to stable plugin

And you can check for yourself: Juantars multiplayer demo example minified!

Socket away!

-----------------------------

Added:

OnEventReceived
   - Triggered when Construct receives a custom socket event.

OnAnyEvent
   - Triggered when the socket receives any event. (All of them!)

one new action:

Emit
   - Emit a custom event through socket. (You must specify which event, and what data to send with that event)


and two expressions:

LastSocketEvent
   -Get the last event that was triggered in Construct.

LastSocketEmittedEvent
   -Get the last event that was emitted by Construct.

Changes:

1) Socket.send ---> socket.emit('message' , data)

2) On data received
-Triggered when socket receives a chunk of data, regardless of event

3) Included recent modifications by @Juantar & @bhavanvaishnav

4) Changed dependency from "socket.io.js" to "socket.io.min.js"

5) Overridden socket.io's emit; hackish solution; not satisfied but works for now, waiting for more decent implementation: link
Problematic code starts at line 110 in runtime.js

5) You can minify the plugin!

Tested on C2 r95, SRWare Iron, 15.0.900.1.

Please test on more browsers and in more situations; haven't had time to test it properly.

I don't recommend to use it in production code, big chance of unexpected behavior!

Download here:
link

Greatest improvement is possibility of minify, if somebody wishes, i can edit older versions of plugin to be minifiable, but i believe this is a good progress!

I'm learning plugin development and javascript with this plugin, so i would be grateful for any help in improving it!

Have a nice day!JohnnySheffield2012-12-02 17:59:31
Be nice until it's time to not be nice
B
36
S
9
G
9
Posts: 293
Reputation: 6,652

Post » Fri Sep 07, 2012 6:02 am

Good job, seems like you already have something solid right here, I'll test it when I get home.
But from the list of conditions and expressions, I can already imagine the possibilities :)
B
36
S
10
G
6
Posts: 948
Reputation: 11,101

Post » Fri Sep 07, 2012 7:37 am

Thank you Rory!

On the side note, playing with plugin, currently experiencing some weird behavior with LastDataElement expression, seems like it catches elements it shouldn't (one element from event before). Hmmm...

I have to work now, will try to fix it later, another signal this is just for testing purposes!
Be nice until it's time to not be nice
B
36
S
9
G
9
Posts: 293
Reputation: 6,652

Post » Sat Sep 08, 2012 9:36 pm

Update on stable version:

Separated emit and send actions, so it doesn't break old projects. Please download again.

Be nice until it's time to not be nice
B
36
S
9
G
9
Posts: 293
Reputation: 6,652

Post » Sat Sep 22, 2012 5:23 pm

Thanks a ton!

Finally able to minify. Worked with Google Chrome and didn't have to change any of the previous plugin settings.

Cheers mate.
B
72
S
10
G
6
Posts: 104
Reputation: 7,550

Post » Mon Oct 08, 2012 6:18 am

Wait.. Is it the Stable Link or the sheffield?
And do I have to run any cmd to update node or socket.io?
B
40
S
11
G
4
Posts: 665
Reputation: 8,403

Post » Tue Oct 09, 2012 12:39 pm

@Schoening

I would recommend to use stable link, but there is no server included in the plugin, so you have to write your own.

It will work with juantars multiplayer demo, so you don't have to change server code.

If i didn't understand you well, please ask again, English is not my first language :)

Aaand i will edit the first post to clarify it a little bit more!
Be nice until it's time to not be nice
B
36
S
9
G
9
Posts: 293
Reputation: 6,652

Post » Tue Oct 23, 2012 8:26 pm

Could you give a quick explaination how the:

var myNumber = count++;


Works? What does determine the count++? And can I replace it with a Facebook ID for example?
B
40
S
11
G
4
Posts: 665
Reputation: 8,403

Post » Wed Oct 24, 2012 3:38 pm

hmmm...

where is that line of code? i'm looking at runtime.js of both mods of plugin (stable and unstable) and i can't find it!

It sounds like it's on server side, if i remember correctly, but i'm not so sure about it...
Be nice until it's time to not be nice
B
36
S
9
G
9
Posts: 293
Reputation: 6,652

Post » Sat Dec 01, 2012 11:33 am

Does data Split only work with "," ?
B
40
S
11
G
4
Posts: 665
Reputation: 8,403

Next

Return to Completed Addons

Who is online

Users browsing this forum: No registered users and 1 guest