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 — & 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!