Author Topic: LazWebSockets how to?  (Read 1307 times)


  • Newbie
  • Posts: 1
LazWebSockets how to?
« on: November 04, 2021, 06:14:39 am »
Hi everyone!

I've just found into LazWebSockets, it seems to be exactly what I was looking for but I can't find any documentation, does anyone know anything about it?

I've been trying to use it for a while but there are some things I can't figure out. I found this post,54250.msg421805.html#msg421805, it partly helped but I can't still get what I need.

What I'm trying to do is to send a message from one client to the server and then to another client (the message contains the userID). I have implemented (following that post) an array containing the userIDs, it adds the userID to the array when the client sends a message consisting of his userID, it's added to the array within MessageReceived event but I'm not sure if it's any good idea to do it this way, shall I do it in WebSocketServer module, along the ConnectionList.Add?
When one client sends a message to the server and it's supposed to be sent to another client, I scan my UserID to get the index and then try to send a message using ConnectionList[l].WriteStringMessage (where l is the index from my UserID list) but sometimes it does and sometimes it doesn't. I'm trying to forward the message right after receiving it, in MessageReceived. I'm not any familiar with threads so I'm not sure if it's the right way of doing this. I'm using locks as recommended.

I was trying to use the example server and another issue I faced is that every client gets disconnected right after connecting if I remove ReadLn(str); from DoHandleCommunication. How is that even possible?

I'm sorry for so many questions, I'm new here and I don't want to be a pain in the... neck :-)

thanks in advance for any hint


TinyPortal © 2005-2018