Skip to content

How to get header msg from on_message #1097

Answered by ghost
fengyonglv asked this question in Q&A
Discussion options

You must be logged in to vote

The UpgradeSync example shows this: https://github.com/uNetworking/uWebSockets/blob/master/examples/UpgradeSync.cpp

You pass a copy of your PerSocketData struct via the res->upgrade call. But, because it is sync, you can also just use a global thread_local variable to temporary point to something in the request. This is not very elegant but it does work and removes the need to keep more than necessary in your PerSocketData.

Replies: 3 comments

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Answer selected
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants
Converted from issue

This discussion was converted from issue #1097 on December 09, 2020 02:21.