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

the request protocol is http not ws? #188

Open
gzhhong opened this issue Jun 16, 2021 · 3 comments
Open

the request protocol is http not ws? #188

gzhhong opened this issue Jun 16, 2021 · 3 comments

Comments

@gzhhong
Copy link

gzhhong commented Jun 16, 2021

Hello all, the request interceptor print the log and shows that scarlet use http instead of ws to send request, and the server side return code 101, "switching protocols", how to fix? thanks.

@solidogen
Copy link

Http request is sent with following headers:

Connection: Upgrade
Upgrade: websocket

101 status means that handshake succeeded and protocol was switched to websocket, and two-way communication is ready.
It just means everything is fine.

https://developer.mozilla.org/en-US/docs/Web/HTTP/Protocol_upgrade_mechanism

@AlCappaccino
Copy link

I am having the same issue, keep getting the same log and it seems like scarlet is connecting and reconnecting all the time. It is indeed not working

@greggiacovelli
Copy link
Contributor

All connections will start with http(s) and then upgrade to ws(s). This is the specification as @solidogen has linked. What you are seeing is completely expected as far as the upgrade path.

Regarding the disconnects, if you are seeing constant disconnects that may need to be investigated, however common issues can include improper control frame timing expectations on the webserver and client. Whereas in order to maintain a live connection a series of messages have to be sent between the client and server (not necessarily within your application). https://datatracker.ietf.org/doc/html/rfc6455#section-5.5 specifically how control messages Ping and Pong relate.

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

4 participants