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

Upgrading HTTP to WebSocket #40

Open
veselov opened this issue Jan 14, 2017 · 1 comment
Open

Upgrading HTTP to WebSocket #40

veselov opened this issue Jan 14, 2017 · 1 comment

Comments

@veselov
Copy link

veselov commented Jan 14, 2017

Hello.

Is there any good example code on how to easily upgrade an HTTP connection to a WS? AFAIU, WSLay should only be engaged after the connection is upgraded, but that does require nearly fully functional HTTP library...

Thank you.

@tatsuhiro-t
Copy link
Owner

Check out https://github.com/tatsuhiro-t/wslay/blob/6abacc1da10344d7d7b13c21edc76fcdf587de0c/examples/testclient.cc

It is design decision to make wslay know only about WebSocket framing layer. It allows for existing HTTP implementation to integrate wslay easily.
Implementing HTTP upgrade for WebSocket does not require full functional HTTP library. It only requires HTTP header parser, and several header field inspections described as RFC 6455.
There are several good HTTP header parsers:

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

2 participants