How do I make Socket.io working properly?

Get help using Construct 2

Post » Sat Feb 21, 2015 7:54 pm

Hi guys,

i am new to Construct and have an issue with the socket.io plugin
viewtopic.php?t=73584&start=0

I did the tutorial :
https://www.scirra.com/tutorials/571/mo ... tio/page-1

But somehow the example project there isn´t working. I Installed node.js on my server, copied the code from the project to a .js file in a directory, installed there socket.io. (everything on ubuntu). Modified the Port in the construct file and the code example from the tutorial to 61000 (see request pictures) and startet the .js file on my server.

Here are two pictures from the debugger of Firefox.
I would really appreciate any help. If you have further questions or need more information just post here or text me.

Thank you very much,
SirSandmann
You do not have the required permissions to view the files attached to this post.
Last edited by SirSandmann on Sat Feb 21, 2015 9:23 pm, edited 1 time in total.
B
4
Posts: 6
Reputation: 216

Post » Sat Feb 21, 2015 8:18 pm

Why don't you use the multiplayer object instead of socket.io? If you're new it's probably better to use easier methods until you really get the hang of Construct before using Node.js as well.

The first thing I notice is the 400 error. This is where the data between the client and server don't follow the same 'rules' per se. Are you using the correct versions of everything? Is the tutorial up to date? etc.
Nothing goes unanswered!
B
22
S
5
G
1
Posts: 430
Reputation: 3,388

Post » Sat Feb 21, 2015 9:21 pm

Hi, i use socket.io because i want to have full mobile support (ios) and i wanted to use my server and also have some programming experience with phaser.js. I think that everything is up to date. But i just recognized, that the response Header is json and the request only accept text/html. But i sill haven´t found an answer to that yet.
B
4
Posts: 6
Reputation: 216

Post » Sun Feb 22, 2015 12:38 am

Are you trying to read JSON as XML or vice versa?
Nothing goes unanswered!
B
22
S
5
G
1
Posts: 430
Reputation: 3,388

Post » Sun Feb 22, 2015 12:14 pm

The problem is, that i can´t even connect to my server. I changed everything that way, that it should just connect to the server, but even that doesn´t work. Does anyone else have problems with that plugin?
B
4
Posts: 6
Reputation: 216

Post » Sun Feb 22, 2015 1:32 pm

Found the Issue: core changed dureing the releases during the tutorial and now
How to fix: downgrade to version 0.9.5 (version of the plugin) then everything should work properly!
B
4
Posts: 6
Reputation: 216

Post » Sun Feb 22, 2015 1:47 pm

But somehow the example project isn´t working though
B
4
Posts: 6
Reputation: 216

Post » Mon Aug 22, 2016 11:38 am

Does not work for me too. Tried also 0.9.5.
B
12
S
4
Posts: 42
Reputation: 840

Post » Mon Aug 22, 2016 2:47 pm

You are trying to connect using HTTP. You need to use WS like:
ws://server-ip/socket.io/i
https://www.ravenheart.ca/home
Company name changed to avoid Facebook-type shenanigans

"Someone once told me I bite off more than I can chew...

I told them I would rather choke on greatness than nibble on mediocrity."
B
22
S
6
G
1
Posts: 1,317
Reputation: 4,628

Post » Tue Aug 23, 2016 11:34 am

gumshoe2029,
thanks for your answer. The problem wasn't the protocol.
I was succesfully connecting form a simple html page using
Code: Select all
var socket = io.connect("http://localhost:8080");

The plugin is working with older socket.io npm package. I tried 0.9.0 an it works.

Does anybody knows if is ther an updated socket.io plugin. I can't find one :/
B
12
S
4
Posts: 42
Reputation: 840

Next

Return to How do I....?

Who is online

Users browsing this forum: bikachu, irwandwiyanto, omnipaws, tarek2 and 6 guests