I used PHP to write a socket server, and then after the Firefox run client handshake successfully,
1. Send a message to the server using the Send () function
2. Service-side Socket__read extract information
3. Re-use the Socket__write return information to trigger the client's OnMessage event.
And under IE and chrome, it doesn't trigger the OnMessage event,
1. First send () sends the message to the server
2.socket__select get socket A, Socket__read get information
3. Return the same information to socket a with socket__write, then listen for socket A, and it will end in Firefox.
However, under IE, socket__select will get socket a again, and then repeat the acquisition and return information to the last listener socket A. Of course, Socket__select will also get socket A, after the first two read and write, this time the Socket__read obtained information will be null value.
By the way, in IE, the first time the server executes the Socket__write return value is int (10), which is normal, and the second write will return int (32), because the PHP file is run under CMD, the information obtained by Socket__read is displayed as Garbled (handshake protocol is shown normal), so I do not know the second time Socket__write return information is what.
Why is that? Obviously shook hands can succeed again, OnOpen event has been triggered, why to OnMessage when there is a problem!
If the above information cannot find the problem, here is my code:
Html:
test
Send
Php:
Reply content:
I used PHP to write a socket server, and then after the Firefox run client handshake successfully,
1. Send a message to the server using the Send () function
2. Service-side Socket__read extract information
3. Re-use the Socket__write return information to trigger the client's OnMessage event.
And under IE and chrome, it doesn't trigger the OnMessage event,
1. First send () sends the message to the server
2.socket__select get socket A, Socket__read get information
3. Return the same information to socket a with socket__write, then listen for socket A, and it will end in Firefox.
However, under IE, socket__select will get socket a again, and then repeat the acquisition and return information to the last listener socket A. Of course, Socket__select will also get socket A, after the first two read and write, this time the Socket__read obtained information will be null value.
By the way, in IE, the first time the server executes the Socket__write return value is int (10), which is normal, and the second write will return int (32), because the PHP file is run under CMD, the information obtained by Socket__read is displayed as Garbled (handshake protocol is shown normal), so I do not know the second time Socket__write return information is what.
Why is that? Obviously shook hands can succeed again, OnOpen event has been triggered, why to OnMessage when there is a problem!
If the above information cannot find the problem, here is my code:
Html:
test
Send
Php:
Reference: https://segmentfault.com/q/1010000004859 ...