Can't connect to server using html5

Post here your questions about the HTML5 / JavaScript for SFS2X

Moderators: Lapo, Bax

Post Reply
zzc11414
Posts: 59
Joined: 26 Jun 2012, 03:17

Can't connect to server using html5

Post by zzc11414 »

I tried to run the demo AdvancedChat. But failed,the message is:"Connection failed: Is the server running at all?"

But the flash demo is ok.

I have installed server patch 2.3. I also activate the websocket in sfs administration.
User avatar
rjgtav
Posts: 2813
Joined: 19 Apr 2009, 11:31
Location: Lisbon, Portugal

Re: Can't connect to server using html5

Post by rjgtav »

Hi,

Have you restarted the server after you enabled the websockets?
Don't forget that the websocket uses a different port than the TCP, UDP and HTTP connections, so don't also forget to forward that extra port in your router, in case you're behind any.
Finally, when you boot the server, right before the "SFS2X READY" message, does it show that it correctly bound the websocket?
Skills: SFS Pro, SFS2X, AS2.0/AS3.0, Java, HTML5/CSS3/JS, C#
Portfolio: https://rjgtav.wordpress.com/
SFS Tutorials: http://sfs-tutor.blogspot.com/ - Discontinued. Some examples may be bugged.
zzc11414
Posts: 59
Joined: 26 Jun 2012, 03:17

Re: Can't connect to server using html5

Post by zzc11414 »

rjgtav wrote:Hi,

Have you restarted the server after you enabled the websockets?
Don't forget that the websocket uses a different port than the TCP, UDP and HTTP connections, so don't also forget to forward that extra port in your router, in case you're behind any.
Finally, when you boot the server, right before the "SFS2X READY" message, does it show that it correctly bound the websocket?
1,I use localhost(127.0.0.1),
2, In server. the startup log:

19:23:47,741 INFO [main] v2.SmartFoxServer - Listening Sockets: { 127.0.0.1:9933, (Tcp) } { 127.0.0.1:9933, (Udp) } { 127.0.0.1:8888 (WebSocket) }
19:23:47,752 INFO [main] v2.SmartFoxServer -
_____ _____ _____ ___ __ __
| __| __| __| |_ | | |
|__ | __|__ | | _|- -|
|_____|__| |_____| |___|__|__|
_____ _____ _____ ____ __ __
| __ | __| _ | \| | |
| -| __| | | |_ _|
|__|__|_____|__|__|____/ |_|
[ 2.3.0 ]
3, log of the port opened :

zzcmatoMacBook:~ zzc$ lsof -i -P |grep -i "listen"
ssh 633 zzc 5u IPv4 0x06af6b58 0t0 TCP 3dns-2.adobe.com:7070 (LISTEN)
ssh 633 zzc 6u IPv6 0x053b96d0 0t0 TCP localhost:7070 (LISTEN)
java 640 zzc 84u IPv6 0x053b85c0 0t0 TCP *:8080 (LISTEN)
java 640 zzc 92u IPv6 0x053b91f0 0t0 TCP [::127.0.0.1]:9933 (LISTEN)
java 640 zzc 94u IPv6 0x053b8830 0t0 TCP [::127.0.0.1]:8888 (LISTEN)
zzc11414
Posts: 59
Joined: 26 Jun 2012, 03:17

Re: Can't connect to server using html5

Post by zzc11414 »

Now,It's OK,thank you.
User avatar
rjgtav
Posts: 2813
Joined: 19 Apr 2009, 11:31
Location: Lisbon, Portugal

Re: Can't connect to server using html5

Post by rjgtav »

What was the problem?
Skills: SFS Pro, SFS2X, AS2.0/AS3.0, Java, HTML5/CSS3/JS, C#
Portfolio: https://rjgtav.wordpress.com/
SFS Tutorials: http://sfs-tutor.blogspot.com/ - Discontinued. Some examples may be bugged.
zzc11414
Posts: 59
Joined: 26 Jun 2012, 03:17

Re: Can't connect to server using html5

Post by zzc11414 »

rjgtav wrote:What was the problem?
It's my fault.I changed the ip to 192.168..... in the client js file and forget to change back to 127.0.0.1
Post Reply