WebSocket

Get help using Construct 2

Post » Thu Jan 24, 2013 2:10 am

Just wondering if anyone has played with the new websocket plugin?
Does it work out the box or do i need a backend to use it?
Sorry for noob questions and thanks for replies in advance.

P.S. I have searched the forums but found nothing
B
15
S
4
G
4
Posts: 28
Reputation: 3,732

Post » Thu Jan 24, 2013 10:20 am

As I read in last release comments, you need to create your websocket server or to use one.
I tried to find one but it's not succesful :/
B
39
S
15
G
5
Posts: 295
Reputation: 6,089

Post » Thu Jan 24, 2013 11:30 am

It will be most useful if you write your own backend, unless you can find a useful WebSocket server that is already being run by someone else that does something you want.
Scirra Founder
B
359
S
214
G
72
Posts: 22,946
Reputation: 178,468

Post » Thu Jan 24, 2013 12:04 pm

@Ashley How hard would it be to deploy a websocket server for C2 on a service like Appfog (I don't know anything about node.js and websockets for the moment)

"With the help of Nodester, we are adding WebSocket support and Node 0.8 support within the coming months."
B
20
S
5
G
8
Posts: 325
Reputation: 6,473

Post » Thu Jan 24, 2013 1:08 pm

@Ashley

Does new Websocket plugin works with C++ websocket server?

Regards
B
14
Posts: 6
Reputation: 1,334

Post » Sat Jan 26, 2013 11:13 am

Anyone knows if C++ server works with C2?
B
14
Posts: 6
Reputation: 1,334

Post » Sat Jan 26, 2013 2:39 pm

Since WebSocket is a standardised protocol, it should be able to talk to any up-to-date WebSocket server, such as one written in C++, or a Node.js version, and so on.
Scirra Founder
B
359
S
214
G
72
Posts: 22,946
Reputation: 178,468

Post » Thu Feb 14, 2013 5:08 am

I can confirm the following:

1: the new websocket plug does NOT work with socket.io socket.io on node which is what the zackowack plugin is based on is not a *true* websockets protocol.

2: it does work with a C# websocket server (I'm running one I've been developing now)

3: if the C++ follows the proper standards and protocols it should work as well.

I honestly prefer it over the socket.io I'm developing my server in C# for the simple fact that I can compile and test it on windows 8 and toss it on one of my Ubuntu servers and it will run without modifications as Linux can run native .Net applications via mono.
B
6
S
1
G
1
Posts: 19
Reputation: 664

Post » Fri Apr 19, 2013 8:38 am

Hi everyone, just a quick correction to the Websocket Plugin.
It currently does not pass the protocol when creating the Websocket object.

To fix it, edit the file "\Program Files\Construct 2\exporters\html5\plugins\websocket\runtime.js" on line 109

and change:

this.ws = new WebSocket(url_);

to:

this.ws = new WebSocket(url_, requireProtocol_);

and it works like a charm. Hope this helps someone. :)

EDIT: Remember to restart Construct 2 for the fix to take effect.DragonDrumstick2013-04-19 08:38:44
B
3
Posts: 3
Reputation: 631

Post » Fri Apr 19, 2013 12:34 pm

@DragonDrumstick - oops, you're right, fixed for the next build. In future it's best to make a full post in the Bugs forum, because I will definitely find it there, instead of coming across a bug by chance in the 'How do I' forum!
Scirra Founder
B
359
S
214
G
72
Posts: 22,946
Reputation: 178,468

Next

Return to How do I....?

Who is online

Users browsing this forum: mercuryus, mystazsea and 19 guests