How to track users using websocket ++ 0.3X

Is there a way to track user data using websocket ++ 0.3X?

I want to be able to identify them in order to keep track of what they are watching and what they should be sent. Take the stack as an example: while you look at this question, websocket can (and I think it does) store in memory that you look at this question and send you relevant updates, such as votes, new comments and answers, and StackExchange Updates in the top left corner.

In addition, users must be able to identify. Is there a session id specific to web sockets that are already hiding in websocket ++? If not, how does websocket ++ track users?

+5
source share
2 answers

The easiest way, as you said in your answer, is to use connection_hdl as a key for an associative container that stores any other data that you need. WebSocket ++ has some other options for cases where such a search would be too expensive.

Since this is a general question, I wrote some formal examples and documentation on how to do it here: http://www.zaphoyd.com/websocketpp/manual/common-patterns/storing-connection-specificsession-information .

+3
source

Oh, OK. He was always hiding in plain sight. http://www.zaphoyd.com/websocketpp/manual/building-program-websocket

- , , . , . - websocketpp:: connection_hdl.

+1

All Articles