can't connect to sfs2x from work computer

Post here your questions about SFS2X. Here we discuss all server-side matters. For client API questions see the dedicated forums.

Moderators: Lapo, Bax

trueicecold
Posts: 84
Joined: 11 Oct 2009, 11:46
Contact:

can't connect to sfs2x from work computer

Postby trueicecold » 21 Nov 2017, 09:36

Hello,

I'm getting an error connecting to sfs using the javascript client api:

sfs2x-api-1.7.6.js:10 WebSocket connection to 'ws://127.0.0.1:8080/BlueBox/websocket' failed: Error during WebSocket handshake: Unexpected response code: 400

using my home computer this works just fine, but on my work computer it doesn't work.

I've verified the port and configuration to match the home computer.

config is rather simple:

config.host = "127.0.0.1";
config.port = 8080;
config.zone = "YanivZone";
config.debug = true;

Changing ports didn't help, navigating to http://127.0.0.1:8080/BlueBox/websocket returns:

HTTP ERROR 400
Problem accessing /BlueBox/websocket. Reason:
HTTP method GET is not supported by this URL

telnet 127.0.0.1 at port 8080 seems to connect to jetty just fine.

Any ideas?
trueicecold
Posts: 84
Joined: 11 Oct 2009, 11:46
Contact:

Re: can't connect to sfs2x from work computer

Postby trueicecold » 21 Nov 2017, 13:35

This is soooo weird...

When a proxy software such as fiddler or charles proxy is opened, I'm able to connect!
as soon as I close them, it fails.

BTW, I'm using a windows system, but I've also tried running sf2x from a linux VM, and it still didn't work, with the same error...
User avatar
Lapo
Site Admin
Posts: 23008
Joined: 21 Mar 2005, 09:50
Location: Italy

Re: can't connect to sfs2x from work computer

Postby Lapo » 21 Nov 2017, 14:22

Hello,
for starters, what SFS2X version are you running?

HTTP ERROR 400
Problem accessing /BlueBox/websocket. Reason:
HTTP method GET is not supported by this URL

This is expected, if you try to connect with a browser instead of a websocket client.

Thanks
Lapo
--
gotoAndPlay()
...addicted to flash games
trueicecold
Posts: 84
Joined: 11 Oct 2009, 11:46
Contact:

Re: can't connect to sfs2x from work computer

Postby trueicecold » 21 Nov 2017, 14:23

I'm using the latest version (2.13.0)

Again, it works on my home computer, but not on the work computer..
User avatar
Lapo
Site Admin
Posts: 23008
Joined: 21 Mar 2005, 09:50
Location: Italy

Re: can't connect to sfs2x from work computer

Postby Lapo » 21 Nov 2017, 14:42

Thanks,
HTTP error code 400 refers to a bad/malformed request.

SFS2X 2.13 supports two different protocols within websockets, the legacy JSON and the binary protocol.
Since you're using the JS API 1.7.6, you're working with the latest version that uses the binary protocol. Make sure that the server is configured to use the binary proto as well.

You find the settings under AdminTool > ServerConfigurator > WebServer

Hope it helps
Lapo

--

gotoAndPlay()

...addicted to flash games
trueicecold
Posts: 84
Joined: 11 Oct 2009, 11:46
Contact:

Re: can't connect to sfs2x from work computer

Postby trueicecold » 21 Nov 2017, 14:51

It is using the WS binary protocol.

My web server settings is as follows:

Image
User avatar
Lapo
Site Admin
Posts: 23008
Joined: 21 Mar 2005, 09:50
Location: Italy

Re: can't connect to sfs2x from work computer

Postby Lapo » 22 Nov 2017, 09:17

Okay, thanks.
I have no idea why you can't connect on your work machine.

It seems that either you are missing something in the (config, client setup...) or you have a local firewall messing with your connections.
Since you're able to connect to the AdminTool the firewall issue might not be the case, but it would also depend on how the firewall is set up. We have seen all sorts of very strange behaviors with local firewalls, such as ZoneAlarm. (This one in particular was pretty nasty and we had to fully uninstall it to get rid of connection issues)

Hope it helps
Lapo

--

gotoAndPlay()

...addicted to flash games
trueicecold
Posts: 84
Joined: 11 Oct 2009, 11:46
Contact:

Re: can't connect to sfs2x from work computer

Postby trueicecold » 22 Nov 2017, 10:10

I assume that if firewall was the case I wouldn't be able to connect to it using telnet or web interface at all.
seems only websocket protocol fails... Also, like I stated, turning on Fiddler or Charles Proxy (without ssl decryption enabled) seems to fix it...

EDIT: oddly enough, chrome and firefox can't connect, but internet explorer is able to connect perfectly...

Testing against http://demos.kaazing.com/echo/, entering:

ws://127.0.0.1:8080/BlueBox/websocket

works on IE (connects), but not in chrome of firefox.
User avatar
Lapo
Site Admin
Posts: 23008
Joined: 21 Mar 2005, 09:50
Location: Italy

Re: can't connect to sfs2x from work computer

Postby Lapo » 22 Nov 2017, 10:54

If this is only happening on one specific machine I think it's a local issue, the cause of which I ignore, unfortunately.
I'd recommend trying on another machine as the behavior you're getting is really bizarre.

Let us know what you find.
Thanks
Lapo

--

gotoAndPlay()

...addicted to flash games
trueicecold
Posts: 84
Joined: 11 Oct 2009, 11:46
Contact:

Re: can't connect to sfs2x from work computer

Postby trueicecold » 22 Nov 2017, 11:01

FOUND IT!

The culprit is the Ad-Muncher. as soon as it's activated (even if disabled!) I can't connect to sfs anymore. quitting it completely fixed it...

PHEW...

FYI
User avatar
Lapo
Site Admin
Posts: 23008
Joined: 21 Mar 2005, 09:50
Location: Italy

Re: can't connect to sfs2x from work computer

Postby Lapo » 22 Nov 2017, 11:08

One more thing.
Using telnet you're just opening a socket connection to the server, but no communication happens. I wouldn't expect that to fail, since you're getting an HTTP error 400 which means a communication is happening.

The problem here is that it seems the data received by the server is incorrect and causes an error. The fact that turning on a local proxy fixes the issue is quite curious... is it possible that the browsers that fail (e.g. Chrome) are configured to use a proxy? If so their traffic would be sent somewhere else, not to SFS2X, hence the error.

Just a thought.
Lapo

--

gotoAndPlay()

...addicted to flash games
trueicecold
Posts: 84
Joined: 11 Oct 2009, 11:46
Contact:

Re: can't connect to sfs2x from work computer

Postby trueicecold » 22 Nov 2017, 11:20

I just replied above you with the problem I had :)

Might be worth mentioning to other developers, although in a production that shouldn't be an issue (unless you use Ad Muncher in a production server ;))
User avatar
Lapo
Site Admin
Posts: 23008
Joined: 21 Mar 2005, 09:50
Location: Italy

Re: can't connect to sfs2x from work computer

Postby Lapo » 22 Nov 2017, 11:45

Ah, interesting!
Good to know, haven't heard of this one before.

Good find.
Lapo

--

gotoAndPlay()

...addicted to flash games

Return to “SFS2X Questions”

Who is online

Users browsing this forum: No registered users and 53 guests