Code Monkey home page Code Monkey logo

Comments (19)

gimite avatar gimite commented on June 29, 2024

Debug version of the player pops up dialog when Flash error happens. Some hints:

  • Can you install Firebug and let me know what message is shown?
  • Does Flash work in other sites?
  • What's version of Flash Player?
  • You can put console.log to some places in web_socket.js (and also to Flash implementation) to see which line of code it reached or not.

from web-socket-js.

TooTallNate avatar TooTallNate commented on June 29, 2024

And just for the record, I just tested on OSX/Firefox 3.6 and it works as expected. I'm using my Java WebSocket server to test with, not the Ruby one, but it's more likely something wrong in your setup.

Firstly, are you running the sample.html file from a file:/// URI? That is allowed, you just need to add the path of the SWF file to Flash's Global Security settings first.

from web-socket-js.

ithinkihaveacat avatar ithinkihaveacat commented on June 29, 2024

Finally figured it out! The WebSocketMain.swf was being served, but in some strange encoding (I'm using a sort of homebrew NodeJS webserver, and it had only ever served text before, so I didn't notice). This broke the Flash file itself, which died silently.

Thanks for your help!

from web-socket-js.

afshinm avatar afshinm commented on June 29, 2024

Hi,

I'm using websocket.js and it worked good in Chrome but in Firefox and IE, WebSocket object created but it not connected to server ...

When i start FireBug, i see some errors:

[WebSocket] cannot connect to Web Socket server at ws://localhost:12345/ (SecurityError) make sure the server is running and Flash socket policy file is correctly placed webSocketError(Object { name="message"})web_socket.js (line 311)
[Break on this error] console.error(decodeURIComponent(message));\n

Whats the problem?

Thanks.

from web-socket-js.

gimite avatar gimite commented on June 29, 2024

Did you place Flash socket policy file in your server? See "Flash socket policy file" section of http://github.com/gimite/web-socket-js .

from web-socket-js.

afshinm avatar afshinm commented on June 29, 2024

Dear gimite,
I read it and i try to do that but i can't, i use PHP Server, can you please help me to place Flash socket policy files?

from web-socket-js.

gimite avatar gimite commented on June 29, 2024

Easiest way would be to run Perl script introduced at:
http://www.lightsphere.com/dev/articles/flash_socket_policy.html
in your server (referred in the "Flash socket policy file" section).

from web-socket-js.

afshinm avatar afshinm commented on June 29, 2024

Thanks dear gimite but i can't work with Perl, can i do this with PHP?
Is there any source for this?

Thanks.

from web-socket-js.

afshinm avatar afshinm commented on June 29, 2024

Hi again,

I put Flash socket policy file with Python and works good but after this step i get this error:

[WebSocket] cannot connect to Web Socket server at ws://localhost:1234/ (IoError)
[Break on this error] console.error(decodeURIComponent(message));\n

Whats the problem?
Thanks.

from web-socket-js.

gimite avatar gimite commented on June 29, 2024

It's most likely that the Web Socket server is not accessible. Does it really work fine with Chrome with same Web Socket URL still? Also your original email shows that you specified ws://localhost:12345/ but now it looks you specify ws://localhost:1234/ . Are you OK with that?

from web-socket-js.

afshinm avatar afshinm commented on June 29, 2024

Yes, it works in Chrome with ws://localhost:12345/ but with same URL it have problem with Firefox and IE.
May this error show because the Client and Server is the same?

from web-socket-js.

gimite avatar gimite commented on June 29, 2024

It should be OK if client and server is in the same host. But it doesn't work when you open the html file as local file i.e. file:///.../sample.html. Please open it via Web server. If you open it with http://... already, I have no idea...

from web-socket-js.

afshinm avatar afshinm commented on June 29, 2024

Thanks you dear gimite, it worked but now i have another problem.
When i start my WebSocket server and start Flash Policy file server, it try to connect to WebSocket server but connection not established and i can't send my messages to server. Here my headers:

[WebSocket] policy file: xmlsocket://172.16.17.211:843
[WebSocket] connected
[WebSocket] request header: GET / HTTP/1.1 Upgrade: WebSocket Connection: Upgrade Host: 172.16.17.211:8181 Origin: http://172.16.17.211 Cookie: PHPSESSID=eab33c48b3a1ab91d746f5268af223ec Sec-WebSocket-Key1: ;2 203 2 2130C 0 Sec-WebSocket-Key2: 4v 4 7 1 12 85_0
[WebSocket] sent key3: 8K<ðïÇ{~
[WebSocket] response header: HTTP/1.1 101 Web Socket Protocol Handshake Upgrade: WebSocket Connection: Upgrade WebSocket-Origin: http://172.16.17.211 WebSocket-Location: ws://172.16.17.211:8181/

When i try to send a message to server i see this error:
INVALID_STATE_ERR: Web Socket connection has not been established

And also WebServer show me that some body connected to server.
It worked in Safari and Chrome but in other browsers like FireFox nd IE i have this problem.

Thank you.

from web-socket-js.

gimite avatar gimite commented on June 29, 2024

Looks like your Web Socket server doesn't support new protocol. Web Socket protocol recently changed and web-socket-js follows new protocol. What Web Socket server are you using? Latest version of web-socket-ruby and em-web-socket supports new protocol. You should check if the server you are using has newer version supporting new protocol. In new protocol, server's response header includes "Sec-WebSocket-Origin" and "Sec-WebSocket-Location" instead of "WebSocket-Origin" and "WebSocket-Location".

from web-socket-js.

afshinm avatar afshinm commented on June 29, 2024

Yes, true.
When i change the Header to "Sec-..." i see nothing, web server also don't work with Firefox and IE, but in Safari i have no error.

from web-socket-js.

afshinm avatar afshinm commented on June 29, 2024

Also when i change headers to "Sec-..." after a few second i get this error:
[WebSocket] digest doesn't match: �server: other d != 3dAÀ�Cá�ÎiÀ×�$¾C

from web-socket-js.

gimite avatar gimite commented on June 29, 2024

Yeah the protocol update is not only about the header name. It also adds some security token exchange. If you use WebSocket server publicly available (e.g. em-websocket), it's likely that its latest version supports new protocol. If you implemented WebSocket server yourself, you should support new protocol yourself... See spec for details: http://tools.ietf.org/html/draft-hixie-thewebsocketprotocol-76

from web-socket-js.

afshinm avatar afshinm commented on June 29, 2024

Thank you dear gimite.
My WebSocket server based on .NET (and also in PHP) so how can i upgrade my protocol?
Is there any tutorial for this?

from web-socket-js.

gimite avatar gimite commented on June 29, 2024

I don't see any useful information other than the original spec: http://tools.ietf.org/html/draft-hixie-thewebsocketprotocol-76
It might be useful to read source code of other WebSocket servers. e.g. If you can read Ruby,
http://github.com/gimite/web-socket-ruby/blob/master/lib/web_socket.rb
might be useful.

from web-socket-js.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.