Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

read method problem, Reading header from websocket failed #23

Open
gspgsp opened this issue Jun 23, 2022 · 6 comments
Open

read method problem, Reading header from websocket failed #23

gspgsp opened this issue Jun 23, 2022 · 6 comments

Comments

@gspgsp
Copy link

gspgsp commented Jun 23, 2022

No description provided.

@Trismegiste
Copy link
Collaborator

Can you provide some details, please ?
What websocket server did you use ?
What kind of error do you encounter ?

I'm currently using the header option in this project :
https://github.com/Trismegiste/eclipse-wiki/blob/master/src/Service/WebsocketPusher.php#L44
and I don't encounter any issue.

In anyway, thanks for your feedback

@maxmistral
Copy link

Hello here !
I wanted to point out the same problem I encountered when using your library for a project :
Fatal error: Uncaught Paragi\PhpWebsocket\ConnectionException: Reading header from websocket failed. in C:\WebServer\htdocs\includes\Framework\WebSocket\Client.php:233

@paragi
Copy link
Owner

paragi commented Aug 22, 2022

The error text might not be altogether that informative, though technically correct.
This is do to a read timeout.

  • What is you read timeout?
  • How long did you wait?
  • How do you catch and handle communication exceptions?

@Trismegiste
Copy link
Collaborator

Uncaught Paragi\PhpWebsocket\ConnectionException

I don't know about your code but obviously you didn't catch exception.
More info on https://github.com/paragi/PHP-websocket-client#exception

@maxmistral
Copy link

maxmistral commented Aug 23, 2022

The page loads a few milliseconds before displaying this error despite a timeout set to 5 seconds.
In fact, the error appears once on ~10 refreshes of my page. It seems that when this happens, the server receives a request to open a connection but does not receive the message sent with the write() function. I specify that my WebSocket sessions are temporary and used only for sending and receiving a single message. I repeat the operation each time I need to consume a different path of the api. It's true that I don't use try catch but I can't understand why the WebSocket server doesn't receive the request sent by the php client.

@chwpi
Copy link

chwpi commented Nov 29, 2022

The page loads a few milliseconds before displaying this error despite a timeout set to 5 seconds. In fact, the error appears once on ~10 refreshes of my page. It seems that when this happens, the server receives a request to open a connection but does not receive the message sent with the write() function. I specify that my WebSocket sessions are temporary and used only for sending and receiving a single message. I repeat the operation each time I need to consume a different path of the api. It's true that I don't use try catch but I can't understand why the WebSocket server doesn't receive the request sent by the php client.

on Tornado websocket server, Tornado is not correct and uses 'Sec-Websocket-Accept: ', but it should be 'Sec-WebSocket-Accept: ' Reading RFC6455 Tornado is at fault unless the response header is not case sensitive. This codebase is case sensitive.

Change the websocket_open function response header to either case insensitive, or correct the one letter that is wrong coming from Tornado

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants