PHPHTML5websocket initialization always fails.

Source: Internet
Author: User
How to initialize PHPHTML5websocket is always a problem with the demo that fails to be downloaded. my implementation is 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


Reply to discussion (solution)

1. browser support is required
2. you need
3. the code is correct.

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!

1. browser support is required
2. you need
3. the code is correct.


Everything you said is okay. I just don't quite understand what that uri means.
For example, the server websocket (uri1, 12345); // uri1 is localhost
So what kind of uri should I use to create a connection from the client to the server?
Either localhost or localhost/test/server. php

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 2 ......

Though not, the uri also contains
However, after I retried it, I immediately broke it,
Firefox cannot establish a connection to the ws: // localhost/test/server. php server.
Socket = new WebSocket (host, 12345 );
The port is also in the Listing status. what is the host, host address, file location, and client?
Can this parameter be passed to WebSocket? localhost: 12345

Solve the problem. it means that Internet Explorer is supported by 10.
Protocol revised, draft10
Pay attention to the handshake protocol, which is relatively simple.
Transmission communication is transmitted by frame, which is a little difficult to study.

Solve the problem. it means that Internet Explorer is supported by 10.
Protocol revised, draft10
Pay attention to the handshake protocol, which is relatively simple.
Transmission communication is transmitted by frame, which is a little difficult to study.



What is this host? host address, file location, client

How did you solve this problem?

How to write the target address in javascript and how to store the file path on the server

Reference reply on the fifth floor:

Solve the problem. it means that Internet Explorer is supported by 10.
Protocol revised, draft10
Pay attention to the handshake protocol, which is relatively simple.
Transmission communication is transmitted by frame, which is a little difficult to study.


What is this host? host address, file location, client

How did you solve this problem?

How to write the target address in javascript and how to store the file path on the server


Host address. In the end, it is socket, and it does not call files.
Pay attention to version and compatibility issues
If key1 and key2 are in the old version, the new browser will not be used and will be depressed.

The Lord, I am also working on this. are you there. If you have any questions

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.