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

Improvement: Add user data pointer to AsyncWebSocketClient #238

Closed
herm opened this issue Sep 30, 2017 · 3 comments
Closed

Improvement: Add user data pointer to AsyncWebSocketClient #238

herm opened this issue Sep 30, 2017 · 3 comments

Comments

@herm
Copy link
Contributor

herm commented Sep 30, 2017

Often it is required to cache a full websocket message before processing it. This buffer needs to be associated to an individual client to avoid race conditions. Currently I need to use std::map to map the client id to a buffer. It would be faster and easier if there was a void * in AsyncWebSocketClient which could be used for any purpose the user of this library wants.

Many other libraries do the same thing, either providing a pointer to the callback or allowing to store data on the object.

Another option would be a new variant of AsyncWebSocketClient which does the buffering internally and only calls the callback once the message is completely received.

@me-no-dev
Copy link
Owner

me-no-dev commented Oct 1, 2017

Done ;) use _tempObject for that (the same one exists also for WebRequest)

@herm
Copy link
Contributor Author

herm commented Oct 1, 2017

Thank you for the quick response. Just one remark: If this is public API the name should probably start without an underscore.

@me-no-dev
Copy link
Owner

maybe but it already does in the request class so better have it the same :)

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