jWebSocket Forum

[Search] Search   [Recent Topics] Recent Topics   [Hottest Topics] Hottest Topics   [Members]  Member Listing   [Groups] Back to home page 
[Register] Register / 
[Login] Login 
Trying to get it to work..  XML
Forum Index » Getting Started
Author Message
Anonymous



Hi folks,

I'm having troubles getting jWebSocket to work locally.
Maybe somebody could have a look and tell me what I'm doing wrong?

Thanks a lot

Environment:
========
gentoo linux
java "1.6.0_20"
Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.3) Gecko/20100429 Gentoo Firefox/3.6.3
jWebSocket: 0.9.0.0522 beta (64bit)
jWebSocketClient: 0.9.0

Description:
=======
1. Downloaded Server http://jwebsocket.googlecode.com/files/jWebSocketServer-0.9.0.zip
2. Set JWEBSOCKET_HOME env variable
3. Started server with loglevel DEBUG: starts without error message.
4. Dowloaded/Extracted client http://jwebsocket.googlecode.com/files/jWebSocketClient-0.9.0.zip
5. Browsed to hello_world.htm example view the index entry page
6. On login I see the message:
...
Connecting to ws://localhost:8787 and logging in as 'test'...
Ok
...
7. On the other actions i.e. request time I get the "Not Connected." error:
...
Requesting server time via WebSockets...
Not connected.
...

Debugging
=======
- Server log does not indicate any connection attempts
- Using the Firebug Add-On in firefox i get the following javascript results:

>>> jws.browserSupportsWebSockets();
true

>>> jWebSocketClient.connect("localhost:8786","test","test");
Object{ code=0, localKey="jws.jsc.res.Ok", msg="Ok", tid=1 }

>>> jWebSocketClient.isConnected();
false
aschulze

jWebSocket Owner
[Avatar]

Joined: 16/03/2010 18:15:55
Messages: 375
Location: Germany, Herzogenrath
Offline

Hi,

at first sight everything you did seems to be correct. I would like to check some items first before we go into details:

I noticed a >>> jWebSocketClient.connect("localhost:8786","test","test"); in your posting. Are you sure you're always using the same port, e.g. 8786 or 8787 (which is default) ? or was this just a typo?
Are you starting the web client with http:// on a webserver or via file:// protocol. For the case you are using file:// it won't work, because the FlashPlayer or the FlashBridge respectively do not support these, you then will have to use a web server, e.g. Apache. The upcoming Firefox 4 is supposed to support WebSockets natively, then this issue probably won't come up again.
Just to allow me to repro: Which Firefox version are you using and which version of the FlashPlayer (should be 10+) ?

We'll get it...

Best regards
Alex
[WWW]
Anonymous



Ok I'm now using a webserver (apache2):

This is:
Firefox/3.6.3
Flash 10.0 r45

1. When I login from the the Hello_World example I see this the debug of the WebSocketServer:

2010-06-17 18:45:53,837 DEBUG - TCPEngine: Received Header (<policy-file-request/>\n)
2010-06-17 18:45:53,838 DEBUG - TCPEngine: Answering flash bridge policy-file-request...
2010-06-17 18:45:53,838 DEBUG - TCPEngine: Received Header again ()

2 .Request time action I still get:

Requesting server time via WebSockets...
Not connected.
Anonymous



3. the javascript debugger gives me the following error output:



Looks like something with the flash bridge.
Could it be the firewall, even though I'm running the application locally?
stojadinovicp

jWebSocket Committer
[Avatar]

Joined: 16/03/2010 21:26:10
Messages: 30
Offline

On Windows, in my case, it WAS the firewall... In my minor Ubuntu testing it wasn't... To be honest, I have no idea about gentoo to answer that question

But, port 843 has to be available for the FlashBridge to work, this is correct. So maybe you can take a look if that port is blocked in some way?

http://stojadinovic.net
aschulze

jWebSocket Owner
[Avatar]

Joined: 16/03/2010 18:15:55
Messages: 375
Location: Germany, Herzogenrath
Offline

Hi All,

we checked your issue and hopefully found a solution or at least some better possibilities to debug...

In the Nightly Build Section you will find the latest update v0.9.0618. Please download this an try again.
We improved the FlashBridge handling and the debug output to check what's exactly the problem on your side.

The FlashBridge has a fallback, if it cannot reach the FlashBridge plug-in on port 843 it tries again at the selected WebSocket port (8787 per default).
This fallback works fine now in the latest update in the case that port 843 is either allocated by another application or is protected by a firewall.
However, the drawback on the first request within a browser session is that it there is a timeout of 3 seconds to detect that 843 does not respond.
This means if port 843 cannot be reached you have to put up a initial latency of three seconds. But at least it should work. If so we'll go deeper...

First off if everythings works fine in your logs you should see:

And this should be the result in Firebug:

I checked what happens when another app allocates port 843. If this is the case you should see the following in your logs:

If port 843 was not be opened by your firewall you shouldn't see any event on port 843
I disabled the FlashBridge-Plug-In and used the TCPEngine's FlashBridge answer. Then you should find the following in your server log:

It's logged as warning because actually the flash bridge should work on port 843.

We also made the check for the Flash policy-file-request a bit more tolerant.
Could you please check if it works now on your side. If not please do me a favor and send me your log files.
You can redirect them into a file by using command-line argument logtarget=rollingfile or logtarget=singlefile.
Thanks in advance for your patience and cooperation.

Alex

This message was edited 2 times. Last update was at 19/06/2010 10:13:57

[WWW]
Anonymous



Hi!

It worked now. For some reasons logtarget/loglevel as well as tweaking xml file had no effect on the logging. I just used ">" to store the console output:

http://dpaste.com/209432/

aschulze

jWebSocket Owner
[Avatar]

Joined: 16/03/2010 18:15:55
Messages: 375
Location: Germany, Herzogenrath
Offline

Very nice to hear that jWebSocket now works in gentoo linux too

And thanks for your logs, however, I noticed that the FlashBridge apparently is NOT loaded at all in your config. I'm missing...

and only find...

Did you remove it from the config file? Or did you experience any issues when using it?
From v0.9.0.0618 the fallback obviously now works perfectly, which is nice, but it still is a fallback which takes about 3 seconds to connect.
What happens if you load the FlashBridge plugin in the jWebSocket.xml like this:

Thanks in advance for your feedback. And IMO the 3 seconds are worth another try...

Best Regards
Alex
[WWW]
Anonymous



Yes of course, flashplugin was deactivated in conf file!

Getting a permission denied error now...

2010-06-21 01:32:22,797 ERROR - FlashBridgePlugIn: FlashBridge could not be started: Permission denied

http://dpaste.com/209609/
Anonymous



well, using "sudo -i" the flashplugin now loads just fine.
Wondering where the permissions issues are?
Well, for now I won't mind the 3sec delay.

Thanks a lot for this work!

http://dpaste.com/209612/
Thomas

jWebSocket Forum User

Joined: 06/05/2010 19:33:33
Messages: 2
Offline

Dear folks,

I had similar problems with setting up the flash bridge a couple of weeks ago when I started working with jWS.

I'm running a Ubuntu Linux system. On my system (I suppose other Linux systems, too), to allocate a port number of <1024 you need to have the capabilities to do so. As I run my jWS application with normal user rights, I had to allow this user to allocate port 843. I googled a bit for a solution and came up with a port redirecting solution involving authbind and socat.

Instead of port 843, my jWS application will open the flash bridge on a non privileged port, say 8843.

With user privileges I run

authbind socat TCP-LISTEN:843,fork TCP:127.0.0.1:8843

to redirect port 843 to 8843. authbind needs to be correctly configured before.

This is how it worked for me.

It's good to see you guys are now also offering the possibility to let the flash bridge work with non privileged port in the new version, so it makes this workaround obsolete.




Katinas

jWebSocket Forum User
[Avatar]

Joined: 04/10/2016 12:21:50
Messages: 1
Offline

Very informing post!
[WWW]
Johnabraham

jWebSocket Forum User

Joined: 28/11/2016 06:56:10
Messages: 1
Offline

great post really appreciable work. That will be valuable to everyone who uses it, including myself. Many thanks!
merry christmas and happy new year
amyburgess

jWebSocket Forum User
[Avatar]

Joined: 16/08/2017 09:28:02
Messages: 2
Location: USA
Offline

Well, did you manage to make it work?

our service can do your homework for you just visit our site
 
Forum Index » Getting Started
Go to:   
Powered by JForum 2.1.9 © JForum Team