I have two clients connected to a websocket server in HTTP.jl. I would like to do the following: send data from client 1 to the websocket server, process the data, send the processed data to client 2. Here is the barebones setup:
@async HTTP.WebSockets.listen("127.0.0.1", UInt16(8081)) do ws while !eof(ws) #read incoming data from client 1 incomming_data = readavailable(ws) #process incomming_data #process the data here ... processed_data = "processed data" #send the processed data to client 2 write(ws, processed_data) end end
Currently, the write
function sends the processed data back to client 1 instead of client 2. Networking is fairly new to me, but I suspect that the
ws object passed to the
write function contains information about the connection, perhaps a connection ID. Based on the documentation, I see that there is a connection pool that can be referenced with
HTTP.ConnectionPool.pool. When I print it out from the listen function, it appears to be empty:
Is there a way to use something like a connection ID to control the flow of information? Thanks.