[Libwebsockets] How to get socket id from incoming request ?

Andy Green andy at warmcat.com
Sun Jun 12 09:52:35 CEST 2016



On June 12, 2016 3:23:19 PM GMT+08:00, Meir Yanovich <meiry242 at gmail.com> wrote:
>Yes this is the case i want it to be lookup key .

If we're talking about the server, the port the socket is connected to on the server side will uniquely identify it, at least while the connection is connected.

But the wsi will also do that... again while it's connected.

Or just increment a magic static index every ESTABLISHED callback and tag the per-connection struct with that.  But if that's all then your map will only grow.

So IIUI you have no choice but track the connection lifecycle, if the type of the id is 'long' then wsi is as good as anything.

-Andy

>On Sun, Jun 12, 2016 at 10:01 AM, Edwin van den Oetelaar <
>oetelaar.automatisering at gmail.com> wrote:
>
>> On Sun, Jun 12, 2016 at 8:12 AM, Meir Yanovich <meiry242 at gmail.com>
>wrote:
>>
>>> I want to keep it as key in hash map
>>>
>>
>> (hash map is implementation detail)
>>
>> So solve what problem?
>> To find the lookup up later and use the connection for a reply maybe?
>>
>>
>>>
>>>
>>>
>>>
>>> ‫ב-12 ביוני 2016, בשעה 06:18, ‏‏Bruce Perens ‏<bruce at perens.com>
>כתב/ה:‬
>>>
>>>
>>>
>>> On Sat, Jun 11, 2016 at 2:33 PM, Andy Green <andy at warmcat.com>
>wrote:
>>>
>>>>
>>>> Why are you asking on the lws list about some socket.io-specific
>detail?
>>>
>>>
>>> Just say what you want to do with it, once you have it, and we can
>>> probably give you a portable way. :-)
>>>
>>> _______________________________________________
>>> Libwebsockets mailing list
>>> Libwebsockets at ml.libwebsockets.org
>>> http://libwebsockets.org/mailman/listinfo/libwebsockets
>>>
>>>
>>
>
>
>------------------------------------------------------------------------
>
>_______________________________________________
>Libwebsockets mailing list
>Libwebsockets at ml.libwebsockets.org
>http://libwebsockets.org/mailman/listinfo/libwebsockets




More information about the Libwebsockets mailing list