Error: INVALID_STATE_ERR: DOM Exception 11 with php websockets
basically it is a rehash of this question: Cannot connect using WebSockets, not changing readyState
Which was not really answered.
I see on the server side:
[nlubin@localhost www]$ php -q /var/www/html/realTime/server/startDaemon.php
2011-03-15 13:49:30 System: Socket Resource id #7 created.
2011-03-15 13:49:30 System: Socket bound to localhost:7332.
2011-03-15 13:49:30 System: Start listening on Socket.
I am using the client and socket from this NetTuts: start using html5 websockets today
When i first go to the client it says in the boxSocket Status: 0
and the server says:
2011-03-15 13:51:53 WebSocket: Resource id #8 CONNECTED!
2011-03-15 13:51:53 WebSocket: Requesting handshake...
2011-03-15 13:51:53 WebSocket: Handshaking...
2011-03-15 13:51:53 WebSocket: Done handshaking...
Then when i send anything it says: "Error: INVALID_ST开发者_JS百科ATE_ERR: DOM Exception 11"
If i click disconnect it disconnects..
Can anyone help?
I got the same error when I was trying to send a message through websocket before it was connected. Make sure your sending logic is triggered in websocket's .onopen
handler (or after it).
make sure your server/browser implement the same version of the websocket draft specification.
check http://en.wikipedia.org/wiki/WebSockets for the implementation status of your browser. If you are using chrome, your browser is most probably in draft-76.
In the comment section of the tutorial you are using someone says the tutorial uses the draft-75.
the comment mentions this other tutorial : http://bohuco.net/blog/2010/07/html5-websockets-example/ which is implementing draft-76
I hope this will help you,
Jerome Wagner
精彩评论