PHPHTML5websocket initialization always fails

Source: Internet
Author: User
Tags php server
How to initialize PHPHTML5websocket is always a problem with the demo that fails to be downloaded. my implementation is like this. First of all, the server. phphttp: // code.google.com/p/phpwebsocket/source/browse/tr PHP HTML5 websocket initialization is always
There are problems with the downloaded demo. my implementation is basically like this.

First, server. php
Http://code.google.com/p/phpwebsocket/source/browse/trunk/%20phpwebsocket/server.php
Client. html
Http://code.google.com/p/phpwebsocket/source/browse/trunk/%20phpwebsocket/client.html

Run the server first to wait, and then run the client:
Var host = "ws: // localhost: 12345/websocket/server. php"; // This path is the file location.
Socket = new WebSocket (host );
This socket will cause an error. alert (socket) is displayed as [object WebSocket]
Note:
Firefox cannot establish a connection to the ws: // localhost: 12345/socket/test/server2.php server.
Socket = new WebSocket (host); // No

(Apache FF11.0)
Please advise:
The expected results are as follows:
Http://websocket.org/echo.html

------ Solution --------------------
1. browser support is required
2. you need
3. the code is correct.
------ Solution --------------------
Function WebSocket ($ address, $ port ){....}

+ -------------------------------------- +
Http://code.google.com/p/phpwebsocket/source/browse/trunk/%20phpwebsocket/server.php
The WebSocket () function in this file needs to transmit two parameters, one address and one port.
No port. run socket_bind ($ master, $ address, $ port) here );
An error will be reported!

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.